The answer to be sure, because the root first traversal corresponding to the first sequence traversal of binary tree root after traversal sequence in the corresponding binary tree traversal, because of the binary tree in the first sequence traversal and sequence traversal can only determine a binary tree, so can only determine a binary sort tree
I think the answer say is very reasonable, but think again, if the tree is a binary tree, then its root first traversal sequence traversal first namely, root traversal is the follow-up after traversal, but the first sequence traversal and subsequent traversal can not only determine a binary tree, is more a tree can not only determine the
Don't know where my idea is wrong, hope everybody who can help me solve
CodePudding user response:
After you messed up, how to answer say "root in the corresponding binary tree traversal sequence traversal" do you think of, behind you and feel "root traversal is the follow-up after traversal", after the problem is not the root traversal sequence traversal in the corresponding or corresponding follow-up traversal? You should know this question,,,CodePudding user response:
"Root first traversal corresponding to the first sequence traversal of binary tree root after traversal sequence in the corresponding binary tree traversal," this is for the tree with the corresponding converted binary tree and said, this is the keyAnswer analysis should have the problem, although the first order with in order to determine a binary tree, but the binary tree is not the only corresponds to a tree, because the tree turn binary tree is unique, which in turn is not
You understand a little problem, a tree is a binary tree, but according to the number of turn of the binary tree rules after conversion, is not the original binary tree (or the above rule is wrong)
The answer to this question should be determined, the strict proof by induction, general analysis is as follows: the binary tree of sequence after sequence traversal and first traversal can not only determine a binary tree, is due to the existence of 1 nodes, which is only a child node, it is left on the right corresponds to the first order and subsequent as the binary tree traversal sequence different, but the tree did not around the concept of, as long as the child node is identified, then the tree is established, on the left is a tree in the right
Probably this is