数据结构实验四二叉树.docxVIP

  • 21
  • 0
  • 约5.79千字
  • 约 12页
  • 2022-06-09 发布于四川
  • 举报
实验四二叉树的存储及应用 void ShowBinTree(BinTree t)BinTree stack[Maxnode],p; int level [Maxnode] [2] ,top,n,i,width=4,k=o; if(t!=NULL){printf(n\n\t\t binary tree show\n\t\tn); top=i;stack[top]=t; level [top] [o] =width;while(topo) {p=stack[top];n=level[top][o]; fbr(i=i;i=n;i++) printf「);printf(n%c H,p-data); k=k+i; if(k==i)printf(Hroot:n);else if(level[top] [i]==i) printf(lchild:); else printf(nrchild:);fbr(i=n+i;i3o;i++) printf(n#);printf(\n\t\t); top-;if(p-rchild!=NULL) {top++; stack[top] =p-rchild; level [top] [o] =n+width; level[top][i] =2; ) if(p-lchild!=NULL) {top++;stack[top]=p-lchild; level [top]

文档评论(0)

1亿VIP精品文档

相关文档