# Selection in heaps and rowsorted matrices using soft

- Slides: 34

Selection in heaps and row-sorted matrices using soft heaps Haim Kaplan László Kozma Or Zamir Uri Zwick (武熠) 清华大学交叉信息研究院 May 15, 2018

Generalized selection All algorithms in this talk are comparison-based. smaller Partial order larger

Generalized selection The generalized sorting problem is well understood. Information-theoretic lower bound is essentially tight. Information-theoretic lower bound for generalized selection may be extremely loose. (E. g. , finding the minimum) General answer for generalized selection is not known. Some interesting special cases were studied.

Some interesting selection problems Binary min-heap Collection of sorted lists Doubly sorted matrix Studied by [Frederickson-Johnson (1982)] [Frederickson (1993)] We give simpler and somewhat improved algorithms.

Selecting the �� -th smallest item in a heap 1 Already extracted 6 7 2 3 9 4 Currently in the heap 7 5 9 8 Not seen yet

7 9 15 11 25 10 16 14 17 12 19 21 23 22 30 Matching the information-theoretic lower bound.

Heaps vs. Soft Heaps [Chazelle ’ 00] [Kaplan-Tarjan-Zwick ’ 13] Fibonacci heaps (Hollow heaps) Soft Heaps Make-heap Insert Extract-min Meld All bounds are amortized. Soft heaps may increase keys of items. Items with increased keys are corrupt.

Previous applications of Soft Heaps An optimal deterministic algorithm for finding minimum spanning trees (with a yet unknown running time) [Pettie-Ramachandran ’ 02] New selection and approximate sorting algorithms [Chazelle ’ 00]

Deletions from a binary heap 7 9 15 11 25 10 16 14 17 12 19 21 23 22 30

Deletions from a binary heap 9 15 11 25 10 16 14 17 12 19 21 23 22 30

Deletions from a binary heap 15 11 25 10 16 14 17 12 19 21 23 22 30

Deletions from a binary heap 9 15 11 25 10 16 14 17 12 19 21 23 22 30

Deletions from a binary heap 9 15 11 25 17 16 14 12 19 21 23 22 30

Deletions from a binary heap 9 10 15 11 25 17 16 14 12 19 21 23 22 30

Deletions from a binary heap 9 10 15 11 25 17 16 14 19 21 23 22 30

Deletions from a binary heap 9 10 15 11 25 12 16 14 17 19 21 23 22 30

Deletions from a binary heap 9 10 15 11 25 12 16 14 17 19 21 23 22 30

Deletions from a binary heap 9 10 15 11 25 12 16 14 17 19 21 23 22 30

Binary heaps with lists [Kaplan-Tarjan-Zwick ’ 13] Corrupt key of all items in the list Tree is heap ordered with respect to corrupt keys 18 22 40 40 Original keys 3 12 2 22 15 1 35 35 30 4 16 17 18 27 27 8 30 45 Each node has a list of items. (Most) items in lists of length>1 are corrupt. 45

Binary heaps with lists [Kaplan-Tarjan-Zwick ’ 13] Corrupt key of all items in the list Tree is heap ordered with respect to corrupt keys 18 22 40 40 3 12 2 22 15 1 35 35 30 4 16 17 18 27 27 8 30 45 45 Deleting an item of smallest corrupt key is easy. Until the list at the root becomes empty…

Double even refill [Kaplan-Tarjan-Zwick ’ 13] Move list of smaller child to root 18 1 12 2 4 16 17 18 56 44 10 45 56

Double even refill [Kaplan-Tarjan-Zwick ’ 13] Recursively fill the child 18 1 12 2 4 16 17 18 56 44 10 45 56

Double even refill [Kaplan-Tarjan-Zwick ’ 13] 18 20 4 14 20 5 1 12 2 4 16 17 18 56 44 10 45 56 Moving lists takes a constant time.

Controlling corruption Corrupt items uncorrupt items Number of corrupt items:

Soft Heaps – assumptions Insert and Meld do not corrupt items. All corruptions are caused by Extract-min, after extraction. Extract-min returns a list of newly corrupted items. Item with smallest (corrupt) key, extracted from the heap.

Selection from a heap using a soft heap Run the naïve algorithm using a soft heap. When an item is extracted, insert its children, and the children of all items corrupted by the extraction, into the soft heap.

Selection from a heap using a soft heap Proof of Claim 1 Corrupt items Barrier The item extracted at each iteration is smaller or equal to the smallest item on the barrier. (We rely on the assumption that corruption occurs only after extractions. )

Selection from a binary heap Proof of Claim 2 Simple!

Row-sorted matrices New “output-sensitive” result:

Split each row into blocks of sizes 1, 2, 4, …

Concluding remarks Results for general partial orders? More applications of Soft Heaps? Thank you for your attention!

- Soft heaps of kaplan and zwick uses
- Transformations using matrices
- 3-6 solving systems using matrices
- Reflexive relation
- Representing relations using matrices
- Two way selection and multiway selection in c
- Two way selection and multiway selection in c
- Mass selection and pure line selection
- Heaps of love
- Lazy binomial heap
- Skew heaps
- Cumulus mean
- Fibonacci
- Reheap up and reheap down
- Tom heaps
- Heaps law example
- Balancing selection vs stabilizing selection
- Artificial selection vs natural selection
- K selection r selection
- Natural selection vs artificial selection
- Difference between continuous and discontinuous variation
- Example of sexual selection
- Clumped dispersion
- Natural selection vs artificial selection
- Three figures and four benches
- Selection sort using recursion
- Classification of wedges
- Expanding along r1
- Applications of matrices and determinants
- Pam and blosum
- Matrix multiplication simulink
- Systems of linear equations matrices
- Graph matrices and application in software testing
- Amino acid substitution matrix
- Inverse of an identity matrix