文章
1
粉丝
56
获赞
0
访问
853
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct TreeNode{
char data;
struct TreeNode *lchild,*rchild;
}TreeNode;
TreeNode* CreateNode(char x){
TreeNode* node = (TreeNode*)malloc(sizeof(TreeNode));
node->data=x;
node->lchild = NULL;
node->rchild = NULL;
return node;
}
TreeNode* CreateTree(char* a,int n,int* pi){
if(a[*pi] == '#'||*pi>=n){
(*pi)++;
return NULL;
}
TreeNode *T = CreateNode(a[*pi]);
(*pi)++;
T->lchild=CreateTree(a,n,pi);
T->rchild=CreateTree(a,n,pi);
return T;
}
void InOrderTraverse(TreeNode* T){
if(T!=NULL){
...
登录后发布评论
暂无评论,来抢沙发