文章
37
粉丝
98
获赞
4
访问
21.8k
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct node {
int data;
struct node* left, * right;
};
struct node* insertTree(struct node* T, int x, struct node* parent) {
if (T == NULL) {//创建结点
T = (struct node*)malloc(sizeof(struct node));
T->data = x;
T->left = NULL;
T->right = NULL;
if (parent == NULL) {
cout << -1 << endl;
}
else {
//输出其父结点值
cout << parent->data << endl;
&...
登录后发布评论
暂无评论,来抢沙发