More trees

Balanced binary search trees (AVL tree) | Non-binary trees (B-tree and variants) | spatial tree

Review of BST

BSTs support operations such as: insert, delete, find min./max. and find successor and predecessor nodes in $O(h)$ time, where h is the height of the tree.
The problem with BSTs: $h$ could be $log(n)$, when the BST is balanced, but $h$ can become as large as $n$ if the BST is very unbalanced.

Balanced binary search tree

AVL tree (named after its inventors: G.M. Adel’son-Vel’skii and E.M. Landis)

Red-black tree (for bored!)

A red-black tree is a binary search tree with one extra attribute for each node: the color, which is either red or black. A red-black tree is a binary search tree which has the following red-black properties: These constraints enforce a critical property of red–black trees: the path from the root to the farthest leaf is no more than twice as long as the path from the root to the nearest leaf. The result is that the tree is roughly height-balanced.
Lemma: A red-black tree with $n$ internal nodes has height at most $2log(n+1)$.
This demonstrates why the red-black tree is a good search tree: it can always be searched in O(log n) time.
Apparently, insertion or removal of an element may violate the properties of a red–black tree. Restoring the red–black properties requires recoloring and some rotations, which can be done efficiently.

The Splay tree (for bored!)

Randomized BST & Treap (tree + heap)

Ref 1: http://jeffe.cs.illinois.edu/teaching/algorithms/notes/10-treaps.pdf

Non-binary trees

2-3 trees, B-trees and B+-trees (slides)

Locality of reference

Spatial data structure: the K-D tree

Spatial data structure: the PR quadtree (for bored)

In the PR quadtree (Point-Region Quadtree), each node either has exactly four children or is a leaf (i.e., the PR quadtree is a full 4-ary tree).
Figure 6 (Shaffer, Fig. 13.16). Example of a PR quadtree.



Another use of quadtrees is not for storing Point-Region data,
but for algorithms that use progressive refinements of heavy computation by working out details only where necessary:

Spatial data structure: R-tree (R is for rectangle) (more on wikipedia)(for bored)

Check out a paper on SpatialHadoop