It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not.

Therefore, following combination can uniquely identify a tree.
Inorder and Preorder.
Inorder and Postorder.
Inorder and Level-order.
And following do not.
Postorder and Preorder.
Preorder and Level-order.
Postorder and Level-order.
For example, Preorder, Level-order and Postorder traversals are same for the trees given in above diagram.
Preorder Traversal = AB
Postorder Traversal = BA
Level-Order Traversal = AB
So, even if three of them (Pre, Post and Level) are given, the tree can not be constructed.
本文探讨了如何通过不同类型的遍历来唯一确定一棵二叉树。文章指出,只有当遍历之一为中序遍历时,才能根据两种遍历组合唯一确定一棵二叉树,并给出了具体的组合方式。
587

被折叠的 条评论
为什么被折叠?



