摘要: void copy(BiTree T,BiTree &NewT){ //复制树 if(T == NULL){ NewT = NULL; return; }else { NewT = new BiTNode; NewT->data = T->data; copy(T->lchild,NewT->lch 阅读全文
posted @ 2020-11-24 22:13 倔强的不死人 阅读(278) 评论(0) 推荐(0) 编辑
摘要: static int w =0; //统计每层节点个数,从而找出最大层数 static int Wid[10]={0}; void Width(BiTree T){ if(T == NULL) return; else { w++; Wid[w]++; Width(T->lchild); if(T- 阅读全文
posted @ 2020-11-24 22:10 倔强的不死人 阅读(1174) 评论(0) 推荐(0) 编辑
摘要: 通过队列就可以方便的将同一层的节点连续地存放在一起 static LinkQueue Q ; //定义一个队列 void levelTraverse(BiTree T){ BiTree e; if(T){ EnQueue(Q,T); //入队列 while(Q.front != Q.rear){ D 阅读全文
posted @ 2020-11-24 21:31 倔强的不死人 阅读(752) 评论(0) 推荐(0) 编辑