A binary search tree is also called a binary sorting tree. It has the following properties:
The root node value is greater than the value of all nodes in the left subtree and less than the value of all nodes in the right subtree.
Therefore, the central order traversal of the binary sorting tree is an incremental ordered sequence.
In the caseAlgorithmAccording to its nature. For example, determine whether a given int-type array is the result of the post-order traversal of a binary sorting tree. If the result of the post-order traversal is ABC, A <C <B. Therefore, starting from the root node (the last node, find all consecutive values greater than the root node as its right subtree, and then forward until the first element of the array. If they are smaller than the root node, use them as the left subtree, then, the left and right Subtrees are recursion using the same method. If there is a value greater than the root node in the forward direction, instead of the result of post-sequential traversal of the Binary Search Tree, return false directly. The time complexity is about O (nlogn ).