摘要
二叉树的遍历操作和其它操作的算法实现,都必须先创建二叉树。分析常规创建二叉树方法的特点和不足,给出利用中序遍历和后序遍历结果还原二叉树的算法,利用这一方法,给出由前序遍历和后序遍历还原二叉树的算法,最后,提供利用次层遍历和中序遍历还原二叉树的算法。
Binary tree should be created while analyzing its traversing and other operation. Common method on creating binary tree is not convenience to use and it is analyzed in this paper. A recursive algorithm of creating binary tree based on in-order-traversing and post-or-der-traversing is proposed. By this way, this paper gives a recursive algorithm of creating binary tree based on in-order-traversing and pre-order-traversing. At last, it provides a recursive algorithm of creating binary tree based on level-traversing and in-order-traversing.
出处
《电脑知识与技术》
2009年第6X期4759-4761,共3页
Computer Knowledge and Technology
关键词
二叉树
递归
遍历
binary tree
recursive
traversing