摘要:
3)分别求二叉树的叶结点,度数为1的结点,度数为2的结点。#include "stdafx.h"#include<iostream>using namespace std;typedef struct BTreeNode{ float data; char optr; struct BTreeNode *lchild,*rchild;}BTree;int _tmain(int argc, _TCHAR* argv[]){ return 0;}int n0,n1,n2;//全局变量,用于统计结点数void Count(BTree *t){ if(t)//前序遍历 阅读全文
摘要:
1)二叉树仅含二元运算符,存储在二叉树BT中,写出计算该算术表达式的值的算法。#include "stdafx.h"#include<iostream>using namespace std;typedef struct BTreeNode{ float data; char optr; struct BTreeNode *lchild,*rchild;}BiNode,*BTree;int _tmain(int argc, _TCHAR* argv[]){ return 0;}float PostEval(BTree bt)//后序遍历{ float lv,rv 阅读全文