Dynamic Ordered Sets with Approximate Queries, Approximate Heaps and Soft Heaps

Authors Mikkel Thorup, Or Zamir, Uri Zwick

Thumbnail PDF


  • Filesize: 454 kB
  • 13 pages

Document Identifiers

Author Details

Mikkel Thorup
  • Department of Computer Science, University of Copenhagen, Denmark
Or Zamir
  • Blavatnik School of Computer Science, Tel Aviv University, Israel
Uri Zwick
  • Blavatnik School of Computer Science, Tel Aviv University, Israel

Cite AsGet BibTex

Mikkel Thorup, Or Zamir, and Uri Zwick. Dynamic Ordered Sets with Approximate Queries, Approximate Heaps and Soft Heaps. In 46th International Colloquium on Automata, Languages, and Programming (ICALP 2019). Leibniz International Proceedings in Informatics (LIPIcs), Volume 132, pp. 95:1-95:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2019)


We consider word RAM data structures for maintaining ordered sets of integers whose select and rank operations are allowed to return approximate results, i.e., ranks, or items whose rank, differ by less than Delta from the exact answer, where Delta=Delta(n) is an error parameter. Related to approximate select and rank is approximate (one-dimensional) nearest-neighbor. A special case of approximate select queries are approximate min queries. Data structures that support approximate min operations are known as approximate heaps (priority queues). Related to approximate heaps are soft heaps, which are approximate heaps with a different notion of approximation. We prove the optimality of all the data structures presented, either through matching cell-probe lower bounds, or through equivalences to well studied static problems. For approximate select, rank, and nearest-neighbor operations we get matching cell-probe lower bounds. We prove an equivalence between approximate min operations, i.e., approximate heaps, and the static partitioning problem. Finally, we prove an equivalence between soft heaps and the classical sorting problem, on a smaller number of items. Our results have many interesting and unexpected consequences. It turns out that approximation greatly speeds up some of these operations, while others are almost unaffected. In particular, while select and rank have identical operation times, both in comparison-based and word RAM implementations, an interesting separation emerges between the approximate versions of these operations in the word RAM model. Approximate select is much faster than approximate rank. It also turns out that approximate min is exponentially faster than the more general approximate select. Next, we show that implementing soft heaps is harder than implementing approximate heaps. The relation between them corresponds to the relation between sorting and partitioning. Finally, as an interesting byproduct, we observe that a combination of known techniques yields a deterministic word RAM algorithm for (exactly) sorting n items in O(n log log_w n) time, where w is the word length. Even for the easier problem of finding duplicates, the best previous deterministic bound was O(min{n log log n,n log_w n}). Our new unifying bound is an improvement when w is sufficiently large compared with n.

Subject Classification

ACM Subject Classification
  • Theory of computation → Data structures design and analysis
  • Order queries
  • word RAM
  • lower bounds


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Arne Andersson, Torben Hagerup, Stefan Nilsson, and Rajeev Raman. Sorting in Linear Time? J. Comput. Syst. Sci., 57(1):74-93, 1998. Announced at STOC'95. URL: http://dx.doi.org/10.1006/jcss.1998.1580.
  2. Arne Andersson and Mikkel Thorup. Dynamic Ordered Sets with Exponential Search Trees. J. ACM, 54(3):Article 13, 2007. Combines results announed at FOCS'96, STOC'00, and SODA'01. Google Scholar
  3. Paul Beame and Faith Fich. Optimal Bounds for the Predecessor Problem and Related Problems. J. Comput. System Sci., 65(1):38-72, 2002. Announced at STOC'99. Google Scholar
  4. Djamal Belazzougui, Gerth Stølting Brodal, and Jesper Sindahl Nielsen. Expected Linear Time Sorting for Word Size Ω(log² n log log n). In Proc. 14^th SWAT, pages 26-37, 2014. URL: http://dx.doi.org/10.1007/978-3-319-08404-6_3.
  5. Bernard Chazelle. A minimum spanning tree algorithm with Inverse-Ackermann type complexity. J. ACM, 47(6):1028-1047, 2000. URL: http://dx.doi.org/10.1145/355541.355562.
  6. Bernard Chazelle. The soft heap: an approximate priority queue with optimal error rate. J. ACM, 47(6):1012-1027, 2000. URL: http://dx.doi.org/10.1145/355541.355554.
  7. L. J. Comrie. The Hollerith and Powers Tabulating Machines. Trans. Office Machinary Users' Assoc., Ltd, pages 25-37, 1929-30. Google Scholar
  8. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff Stein. Introduction to algorithms. The MIT Press, 3rd edition, 2009. Google Scholar
  9. A. I. Dumey. Indexing for rapid random access memory systems. Computers and Automation, 5(12):6-9, 1956. Google Scholar
  10. Adrian Dumitrescu. A Selectable Sloppy Heap. CoRR, abs/1607.07673, 2016. URL: http://arxiv.org/abs/1607.07673.
  11. Michael L. Fredman. Comments on Dumitrescu’s "A Selectable Sloppy Heap". CoRR, abs/1610.02953, 2016. URL: http://arxiv.org/abs/1610.02953.
  12. Michael L. Fredman and Michael E. Saks. The Cell Probe Complexity of Dynamic Data Structures. In Proc. 21^st STOC, pages 345-354, 1989. Google Scholar
  13. Michael L. Fredman and Dan E. Willard. Surpassing the information theoretic bound with fusion trees. J. Comput. Syst. Sci., 47:424-436, 1993. Announced at STOC'90. Google Scholar
  14. Yijie Han. Deterministic Sorting in O(n log log n) Time and Linear Space. J. Algorithms, 50(1):95-105, 2004. Announced at STOC'02. Google Scholar
  15. Yijie Han and Mikkel Thorup. Integer Sorting in O(n√log log n) Expected Time and Linear Space. In Proc. 43^rd FOCS, pages 135-144, 2002. Google Scholar
  16. Haim Kaplan, László Kozma, Or Zamir, and Uri Zwick. Selection from Heaps, Row-Sorted Matrices, and X+Y Using Soft Heaps. In 2nd Symposium on Simplicity in Algorithms, SOSA@SODA 2019, January 8-9, 2019 - San Diego, CA, USA, pages 5:1-5:21, 2019. URL: http://dx.doi.org/10.4230/OASIcs.SOSA.2019.5.
  17. Haim Kaplan, Robert Endre Tarjan, and Uri Zwick. Soft Heaps Simplified. SIAM J. Comput., 42(4):1660-1673, 2013. URL: http://dx.doi.org/10.1137/120880185.
  18. B.W. Kernighan and D.M. Ritchie. The C Programming Language. Prentice Hall, 1978. Google Scholar
  19. Mihai Pǎtraşcu and Mikkel Thorup. Time-space trade-offs for predecessor search. In Proc. 38^th STOC, pages 232-240, 2006. URL: http://dx.doi.org/10.1145/1132516.1132551.
  20. Mihai Pǎtraşcu and Mikkel Thorup. Dynamic Integer Sets with Optimal Rank, Select, and Predecessor Search. In Proc. 55^th FOCS, pages 166-175, 2014. URL: http://dx.doi.org/10.1109/FOCS.2014.26.
  21. Mikkel Thorup. Equivalence between priority queues and sorting. J. ACM, 54(6):28, 2007. Announced at FOCS'02. URL: http://dx.doi.org/10.1145/1314690.1314692.