Binary sort tree also known as binary search tree, it can be an empty tree, if not empty, has the following properties:
- The left subtree of the Joghen node is not empty, then all the nodes on the left subtree are less than the key value of the root node;
- The right subtree of the Joghen node is non-empty, and all the nodes on the right subtree are of the key value greater than or equal to the root node;
- The left and right sub-trees of the root node are also the binary sort tree;
What are precursors and successors:
- The precursor of a node: the largest node in the left subtree of the node;
- The successor of the node is the smallest node in the right sub-tree of the nodal point;
That is, in the middle sequence traversal, the node before and after the junction is the predecessor of the node and the successor of the nodal point.
Other look at this wonderful blog post, no longer make the wheel again.
Data structure--two forks find (sort) tree