Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Properties of Binary Search Tree

Properties of Binary Search Tree

I. Ordering Property

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

The purpose of using a binary search tree is to immediately obtain the value by looking up the key. minimum, maximum, successor (successor), predecessor (predecessor), floor (floor), ceil (ceiling), rank (which element ranks where), and select (which element ranks nth) are all manifestations of the ordering property of a binary search tree.

II. Limitations

A binary search tree has limitations in time performance.

As shown in the figure below, with the same element nodes, two different binary search trees can be formed, both satisfying the definition:

A binary search tree may degenerate into a linked list. Accordingly, the search operation of a binary search tree is related to the height of the tree, and at this point the height of the tree is the number of nodes n. Meanwhile, all corresponding algorithms of the binary search tree degenerate to the O(n) level.