Query of largest element in a set less than an element
In computer science, the predecessor problem involves maintaining a set of items to, given an element, efficiently query which element precedes or succeeds that element in an order. Data structures used to solve the problem include balanced binary search trees, van Emde Boas trees, and fusion trees. In the static predecessor problem, the set of elements does not change, but in the dynamic predecessor problem, insertions into and deletions from the set are allowed.[1]
The predecessor problem is a simple case of the nearest neighbor problem, and data structures that solve it have applications in problems like integer sorting.
The problem consists of maintaining a set S, which contains a subset of U integers. Each of these integers can be stored with a word size of w, implying that . Data structures that solve the problem support these operations:[2]
predecessor(x), which returns the largest element in S strictly smaller than x
successor(x), which returns the smallest element in S strictly greater than x
In addition, data structures which solve the dynamic version of the problem also support these operations:
There have been a number of papers proving lower bounds on the predecessor problem, or identifying what the running time of asymptotically optimal solutions would be. For example, Michael Beame and Faith Ellen proved that for all values of w, there exists a value of n with query time (in Big Theta notation) , and similarly, for all values of n, there exists a value of n such that the query time is .[1] Other proofs of lower bounds include the notion of communication complexity.
For the static predecessor problem, Mihai Pătrașcu and Mikkel Thorup showed the following lower bound for the optimal search time, in the cell-probe model:[7]
where the RAM has word length , the set contains integers of bits each and is represented in the RAM using words of space, and defining .
In the case where for and , the optimal search time is
and the van Emde Boas tree achieves this bound.[7]