A Van Emde Boas (vEB) tree is a data structure that supports operations on a dynamic set of
A vEB tree for a universe of size
-
If
$u = 2$ , the vEB tree is a simple base case where it can hold only two elements, and operations can be performed in constant time. -
If
$u > 2$ , the vEB tree is divided into two levels: a top level and a bottom level.- The top level, or summary, is a vEB tree of size
$\sqrt{u}$ . - The bottom level consists of
$\sqrt{u}$ clusters, each of size$\sqrt{u}$ .
- The top level, or summary, is a vEB tree of size
The key operations supported by a Van Emde Boas tree include the Priority Queue operations:
- Insertion
- Deletion
- Membership query (contains)
- Successor query (finding smallest element larger than a given element)
- Minimum
- Maximum
- Determine the cluster in which
$x$ belongs, i.e.,$x$ is mapped to a cluster index$\lceil{x / \sqrt{u}} \rceil$ and a position within the cluster$pos = x \mod \sqrt{u}$ . - Recursively insert
$pos$ into the corresponding cluster. - If the cluster was previously empty, update the summary to reflect the presence of this cluster.
- Determine the cluster and position within the cluster as in insertion.
- Recursively delete
$pos$ from the corresponding cluster. - If the cluster becomes empty, update the summary to reflect the absence of this cluster.
To check if an element
- Determine the cluster and position.
- Recursively check for membership in the corresponding cluster.
- Determine the cluster and position.
- Recursively find the successor or predecessor within the cluster or use the summary to jump to the next non-empty cluster if necessary.
The time complexity for each operation in a vEB tree is determined by the depth of the recursion.
Each recursive step reduces the universe size from
Therefore, the time complexity of those operations is
This is significantly better than the