#include<iostream>
using namespace std;
struct node
{
node *lChild;
node *rChild;
char data;
};
//先序递归创建树
node *createTree()
{
char ch;
cin>>ch;
node *root;
if(ch=='#')
{
return NULL;
}
else
{
root=new node();
root->data=ch;
root->lChild=createTree();
root->rChild=createTree();
return root;
}
}
//先序打印
void print(node *t)
{
if(t)
{
cout<<t->data<<" ";
print(t->lChild);
print(t->rChild);
}
}
//结点个数
in
二叉链表的基本操作
最新推荐文章于 2023-02-19 18:26:03 发布