标签:text leave blog 完全 har stl 复杂 order 完全二叉树
二叉树性质
(结点-1=边)
一般二叉树用数组存储 易造成空间浪费
课堂笔记
除了根节点之外,树的每个节点都有唯一的一个入度,因此计算出共有多少个出度,+1=总节点数目。20+2+20+1=43 结点总数 = 分支总数+1
课堂笔记
堆与栈的内存分配 为什么cin>>n; new BiTree[n]可以但是int a[n]不可以?
类型定义 注意结点 
void MidOrder(BiTree[] t,int root)
{
int l,r,i=root;
l=t[i].lchild;
r=t[i].rchild;
if(l) MidOrder(t,l);
cout<<t[i].data;
if(r) MidOrder(t,r);
}

参考资料https://www.cnblogs.com/jingjing1234/p/10822040.html
ruolin小组的递归
int depth(bitnode tree[],int ownnum)
{
if(tree[ownnum].num==0)//到底了
return 0;
int max=0;
for(int i=0;i<tree[ownnum].num;i++)
{//遍历每个孩子,寻找孩子中的最大值
int childdepth=depth(tree,tree[ownnum].child[i])+1;//每递归一次深度加一,得到目前结点的深度
if(childdepth>max)
max=childdepth;
}
return max;//返回当前深度给上一层
}
改进方向 其他小组意见


哈哈记得要释放空间啊
标签:text leave blog 完全 har stl 复杂 order 完全二叉树
原文地址:https://www.cnblogs.com/drgnibasaw/p/12868089.html