用二叉树来表示代数表达式
(1)算法描述
定义一个二叉树类型,实现二叉树的创建,将表达式用二叉树的前序遍历表达出来
(2)对应代码
#include <iostream>
#include<malloc.h>
#include<string.h>
using namespace std;
typedef struct node
{
char data;
struct node* lchild;
struct node* rchild;
}BTNode;
BTNode* CTree(char s[],int i,int j)
{