Predecessor problem
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.
Definition
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 [math]\displaystyle{ U \le 2^w }[/math]. Data structures that solve the problem support these operations:[2]
predecessor(x)
, which returns the largest element in S less than or equal to xsuccessor(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 Sdelete(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 [math]\displaystyle{ O(\log n) }[/math] for predecessor queries. The Van Emde Boas tree achieves a query time of [math]\displaystyle{ O(\log \log U) }[/math], but requires [math]\displaystyle{ O(U) }[/math] space.[1] Dan Willard proposed an improvement on this space usage with the x-fast trie, which requires [math]\displaystyle{ O(n \log U) }[/math] space and the same query time, and the more complicated y-fast trie, which only requires [math]\displaystyle{ O(n) }[/math] space.[3] Fusion trees, introduced by Michael Fredman and Willard, achieve [math]\displaystyle{ O(\log_w n) }[/math] query time and [math]\displaystyle{ O(n) }[/math] for predecessor queries for the static problem.[4] The dynamic problem has been solved using exponential trees with [math]\displaystyle{ O(\log_w n + \log \log n) }[/math] query time,[5] and with expected time [math]\displaystyle{ O(\log_w n) }[/math] using hashing.[6]
Mathematical properties
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) [math]\displaystyle{ \Omega\left(\tfrac{\log w}{\log \log w}\right) }[/math], and similarly, for all values of n, there exists a value of n such that the query time is [math]\displaystyle{ \Omega\left(\sqrt{\tfrac{\log n}{\log \log n}}\right) }[/math].[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] [math]\displaystyle{ O(1) \min \left\{ \begin{array}{l} \log_{w} n \\ \lg \frac{\ell - \lg n}{a} \\ \frac{\lg \frac{\ell}{a}}{\lg \left( \frac{a}{\lg n} \,\cdot\, \lg \frac{\ell}{a} \right)} \\ \frac{\lg \frac{\ell}{a}}{\lg \left( \lg \frac{\ell}{a} \right/\left. \lg\frac{\lg n}{a} \right)} \end{array} \right. }[/math] where the RAM has word length [math]\displaystyle{ w }[/math], the set contains [math]\displaystyle{ n }[/math] integers of [math]\displaystyle{ \ell }[/math] bits each and is represented in the RAM using [math]\displaystyle{ S }[/math] words of space, and defining [math]\displaystyle{ a = \lg \frac{S}{n} + \lg w }[/math].
In the case where [math]\displaystyle{ w = \ell = \gamma \lg n }[/math] for [math]\displaystyle{ \gamma \gt 1 }[/math] and [math]\displaystyle{ S = n \cdot \lg^{O(1)} n }[/math], the optimal search time is [math]\displaystyle{ \Theta(\lg \ell) }[/math] and the van Emde Boas tree achieves this bound.[7]
See also
References
- ↑ 1.0 1.1 1.2 Beame, Paul; Fich, Faith (August 2002). "Optimal Bounds for the Predecessor Problem and Related Problems". Journal of Computer and System Sciences 65 (1): 38–72. doi:10.1006/jcss.2002.1822.
- ↑ Rahman, Naila; Cole, Richard; Raman, Rajeev (17 August 2001). "Optimized Predecessor Data Structures for Internal Memory". International Workshop on Algorithm Engineering. pp. 67–78. https://www.cc.gatech.edu/~bader/COURSES/UNM/ece637-Fall2003/papers/RCR01.pdf.
- ↑ Willard, Dan (24 August 1983). "Log-logarithmic worst-case range queries are possible in space Θ(n)". Information Processing Letters 17 (2): 81–84. doi:10.1016/0020-0190(83)90075-3.
- ↑ Fredman, Michael; Willard, Dan (1990). "Blasting through the information theoretic barrier with fusion trees". Symposium on Theory of Computing: 1–7.
- ↑ Andersson, Arne (2007), "Dynamic ordered sets with exponential search trees", Journal of the ACM 54 (3): A13, doi:10.1145/1236457.1236460.
- ↑ Raman, Rajeev (1996), "Priority queues: small, monotone and trans-dichotomous", Fourth Annual European Symposium on Algorithms (ESA '96), Barcelona, Spain, September 25–27, 1996, Lecture Notes in Computer Science, 1136, Berlin: Springer-Verlag, pp. 121–137, doi:10.1007/3-540-61680-2_51, ISBN 978-3-540-61680-1.
- ↑ 7.0 7.1 Pătraşcu, Mihai; Thorup, Mikkel (21 May 2006). "Time-space trade-offs for predecessor search". Proceedings of the thirty-eighth annual ACM symposium on Theory of Computing. pp. 232–240. doi:10.1145/1132516.1132551. ISBN 1595931341.
Original source: https://en.wikipedia.org/wiki/Predecessor problem.
Read more |