Binary Search Tree

A binary search tree is a special subset of the standard binary tree. The difference lies in the fact that a binary search tree requires that all nodes be sorted into a particular order.

Typically the nodes in a binary search tree are sorted such that for any given sub-tree the left child is smaller than or equal to the root node, and the right child is larger than the root node. Conversely the nodes could be sorted in the exact opposite order (with larger nodes on the left), and equal nodes can be sorted to either side of the parent (though a consistent decision must be made and maintained for the entire tree).

This allows elements in the tree to be searched using a variation of the binary search algorithm, yeilding a result in O(log(n)) time.