C二叉树先序建立

最近发现许多学生在使用先序创建二叉树时,总是说自己的程序进入了死循环不能退出,这里说明一下,如果你的程序类似于如下: typedef struct TreeNode{ int data; struct TreeNode *Lchild,*Rchild;}*Tree; void CreateTree(Tree &amp;t){ int ch; cout<<"输入结点数字:"<<endl; cin>>ch; if(ch==0) t=NULL; else { t=(Tree)new TreeNode; t->data=ch; CreateTree(t->Lchild); Cre...
C编程经验 | 2011-05-16 23:22 | 阅读 794 次 | 评论 0 条
最新评论