博文

二叉树遍历非递归算法(2006-10-29 21:46:00)

摘要: PreOrder(BiTree T)  //先序非递归遍历二叉树  {           InitStack(S);  //创建工作栈           Push(S,T);           while(!StackEmpty(S))           {                     Pop(S,p);  //出栈                     Visit(p);   //访问                     if(p->rchild)                               Push(S,p->rchild);  //右......

阅读全文(4594) | 评论:0