2013年7月16日
摘要: 参考线索二叉树的建立方法,对二叉查找树进行中序遍历,遍历中保存1个pre指针,指向刚刚访问过的节点,即当前节点的中序前驱。代码如下:#include#includeusing namespace std;typedef struct node{ int data; struct node* left; struct node* right;}Tree;//输入二叉查找树的先序顺序,NULL指针用0代替Tree* create(void){ int d; Tree *root=NULL; //按先序输入,NULL指针是0 cin>>d; if(d==0) return NULL; e 阅读全文
posted @ 2013-07-16 22:17 紫金树下 阅读(200) 评论(0) 推荐(0) 编辑