二叉树转双向链表-和-中缀转二树.docVIP

  • 0
  • 0
  • 约8.55千字
  • 约 9页
  • 2019-09-27 发布于江苏
  • 举报
#include stdio.h #include iostream.h #include stdlib.h #include time.h typedef char elemtype; struct bnode { elemtype data; struct bnode *lchild,*rchild; }; const N=10; struct bnode *s[N]; int h=-1,r=-1,k=0; struct bnode *set_tree() { struct bnode *t,*p,*q; int i; char d; t=new(bnode); t-data=rand() % 26 + A; t-lchild=NULL; t-rchild=NULL; for (i=1;iN;i++) { p=t; d=rand() % 26 + A; while (p!=NULL) if (dp-data) {q=p; p=p-rchild;} else { q=p; p=p-lchild;} p=new(bnode); p-data=d; p-lchild=NULL; p-rchild=NULL; if (dq-data)

文档评论(0)

1亿VIP精品文档

相关文档