Properties of Binary Search Trees

1. Sequence

A binary search tree can be thought of as an implementation of a lookup table.

The purpose of our binary search tree is to get the value immediately by looking up the key. minimum, maximum, successor (successor), predecessor (predecessor), floor (floor), ceil (ceiling, rank (ranked element), select (who is the nth element) These are binary search tree order Performance.

2. Limitations

Binary search trees are limited in time performance.

As shown in the figure below, like element nodes, two different binary search trees are formed, all of which satisfy the definition:

The binary search tree may degenerate into a linked list. Correspondingly, the search operation of the binary search tree is related to the height of the tree. At this time, the height of the tree is the number n of nodes in the tree. At the same time, the binary search The algorithms corresponding to the tree all degenerate into O(n) level.

 

Guess you like

Origin blog.csdn.net/unbelievevc/article/details/131370137