English

Selection from heaps, row-sorted matrices and $X+Y$ using soft heaps

Data Structures and Algorithms 2018-02-21 v1

Abstract

We use soft heaps to obtain simpler optimal algorithms for selecting the kk-th smallest item, and the set of~kk smallest items, from a heap-ordered tree, from a collection of sorted lists, and from X+YX+Y, where XX and YY are two unsorted sets. Our results match, and in some ways extend and improve, classical results of Frederickson (1993) and Frederickson and Johnson (1982). In particular, for selecting the kk-th smallest item, or the set of~kk smallest items, from a collection of~mm sorted lists we obtain a new optimal "output-sensitive" algorithm that performs only O(m+i=1mlog(ki+1))O(m+\sum_{i=1}^m \log(k_i+1)) comparisons, where kik_i is the number of items of the ii-th list that belong to the overall set of~kk smallest items.

Keywords

Cite

@article{arxiv.1802.07041,
  title  = {Selection from heaps, row-sorted matrices and $X+Y$ using soft heaps},
  author = {Haim Kaplan and László Kozma and Or Zamir and Uri Zwick},
  journal= {arXiv preprint arXiv:1802.07041},
  year   = {2018}
}

Comments

20 pages, 4 figures

R2 v1 2026-06-23T00:27:25.218Z