文章
37
粉丝
98
获赞
4
访问
21.8k
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//全局变量
string str;
int len, cnt = 0,nums=0;
struct node {
char ch;
struct node* left,*right;
};
struct node* createTree(struct node* T) {//创建树
if (str[cnt] == ' ') {
cnt++;
}
if (str[cnt] == '0' || cnt == len) {
cnt++;
return NULL;
}
if (T == NULL) {
T = (struct node*)malloc(sizeof(struct node));
T->ch = str[cnt++];
T->left = NULL;
T->right = NULL;
T->left = createTree(T->left);
&n...
登录后发布评论
暂无评论,来抢沙发