Jump to content

Predecessor problem

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pzoxicuvybtnrm (talk | contribs) at 03:14, 13 December 2017 (add problem formal definition, describe data structures in some detail). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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]

Definition

The problem consists of maintaining a set S, which 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:

  • predecessor(x), which returns the largest element in S less than or equal to x
  • successor(x), which returns the smallest element in S greater than or equal to x

In addition, data structures which solve the dynamic version of the problem also support these operations:

  • insert(x), which adds x to the set S
  • delete(x), which removes x from the set S

The problem is typically analyzed in a transdichotomous model of computation such as word RAM.

Data structures

One simple solution to this problem is to use a balanced binary search tree, which achieves (in Big O notation) a running time of for predecessor queries. The Van Emde Boas tree achieves a query time of , but requires space.[1] An improvement on this is the y-fast trie, which only requires space but still achieves predecessor queries in .

References

  1. ^ a b Beame, Paul; Fich, Faith (August 2002). "Optimal Bounds for the Predecessor Problem and Related Problems" (PDF). Journal of Computer and System Sciences. 65 (1): 38–72. doi:10.1006/jcss.2002.1822.