Subsequent 23_____ binary search tree traversal

Knowledge Abstract :

1. binary search tree (also known as: binary sort tree, binary search tree):

Follows: Tree.left.val <Tree.val <Tree.right.val so it is a must in order traversal sequence.

2. Some other trees:

Full Binary: from the top down, in addition to the leaf nodes, the left and right child nodes to other nodes are present.

Complete binary tree: a few less than the full binary tree leaf node, leaf nodes from left to right placement.

Balanced binary tree: its left and right subtrees height difference absolute value is not greater than 1, and its left and right subtrees are balanced binary tree.

 

Subject description:

Enter an integer array, the array is not the result of the determination after traversing a binary search tree. If the output Yes, otherwise the output No. Suppose the input array of any two numbers are different from each other.

Ideas:

 

 

{5, 7, 6, 9, 11, 10, 8} is more search results postorder traversal of a binary tree. Can be found by observing: the last element [8] is, before the root of the binary tree search, the root element in the array, if the root node is less than the left subtree, if the root node is greater than the right subtree. Then continue recursively calculated.

 

Guess you like

Origin www.cnblogs.com/xbfchder/p/11470384.html