(A Survey on) Priority Queues Gerth Stølting Brodal Aarhus Universty IanFest, University of Waterloo, Waterloo, Ontario, Canada, August 14-15, 2013
Download ReportTranscript (A Survey on) Priority Queues Gerth Stølting Brodal Aarhus Universty IanFest, University of Waterloo, Waterloo, Ontario, Canada, August 14-15, 2013
(A Survey on) Priority Queues Gerth Stølting Brodal Aarhus Universty IanFest, University of Waterloo, Waterloo, Ontario, Canada, August 14-15, 2013 Program Ian Munro : A Constant Time Priority Queue Gerth Brodal : A Constant Time Priority Queue 2 Priority Queue Insert ExtractMin FindMin Delete DecreaseKey Meld ExtractMax (double-ended priority queue) 3 7 ,513 1 7,542 13 ,7 3 2 7,5 42 ,4 4 66 ,6 5 13 ,7 6 7 7,5 7,5 13,7 42,4 7,5 66,6 13,7 1 Communications of the ACM (1962) 2 3 4 5 6 7 4 5 Communications of the ACM (1964) Heap 2 5 3 • • • • • • 7 66 2 5 7 3 1 2 3 4 66 42 5 6 42 Simple Implicit – single array of size n Insert and ExtractMin O(log n) Construction O(n) Insert (loglog n) comparisons Select k smallest in O(k) time Willliams (1964) Floyd(1964) Gonnet, Munro (1986) Frederickson (1993) 6 Comparison Lower Bound n x Insert + n x ExtractMin Sorting Insert or ExtractMin (log n) comparisons Comparisons Insert ExtractMin Heap Binary search Carlsson, Munro, Poblette (1988) O(log n) O(log n) O(1) O(log n) 0 O(log n) 7 Priority Queues Directions of Research Worst-case vs Amortized Comparisons vs Bit-tricks Theory vs Implementation O vs Constants InsertExtractMin vs DecreaseKey, Meld,… Single processor vs Parallel RAM vs Hierarchical memory Aware vs Oblivious Simplicity vs Let’s-do-somethingcomplicated Weak vs Strong Implicit vs Space wasting 8 Open Problem Can only store n + array between operations Strongly implicit priority queue worst-case O(1) Insert and O(log n) ExtractMin supporting identical elements O(1) swaps per operation and cache oblivious optimal ? 9 ExtractMin Implicit Swaps Identical elements log n log n Strong log n Yes Carlsson, Munro, Poblette (1988) 1 log n Weak log n Yes Arge, Bender, Demaine, HollandMinkley, Munro (2002) log n log n log n Yes Munro, Franceschini (2006) log n log n Strong 1 1 log n Strong log n amortized bounds Heaps Harvey, Zatloukal (2004) Brodal, Nielsen, Truelsen (2013) Open 1 log n Strong log n 1 x x log n x x Strong 1 Cache oblivious Insert (Some Random) Results Yes Yes Yes Yes x x Implicit dictionary O(n) Munro, Suwanda (1980) O(log2 n) Munro (1986) O(log2 n/loglog n) Franceschini, Grossi, Munro, Pagli (2004) 10 Some Observations Pair encoding: Munro (1986) 42 66 66 42 66 66 Bit = 1 Bit = 0 ??? 2log n elements can encode a pointer O(log n) time allows pointer manipulations Strict implicit + O(1) insertions Insertions ”close to oblivious” 11 Strict Implicit Priority Queue O(1) Insert and O(log n) ExtractMin …work in progress Brodal, Nielsen, Truelsen (2013) • • • • Forest, trees powers-of-2 Looser trees Pair-encode bits at nodes Insertions balance using LSB(n) 12 ExtractMin Implicit Swaps Identical elements log n log n Strong log n Yes Carlsson, Munro, Poblette (1988) 1 log n Weak log n Yes Arge, Bender, Demaine, HollandMinkley, Munro (2002) log n log n log n Yes Munro, Franceschini (2006) log n log n Strong 1 1 log n Strong log n amortized bounds Heaps Harvey, Zatloukal (2004) Brodal, Nielsen, Truelsen (2013) Open 1 log n Strong log n 1 x x log n x x Strong 1 Cache oblivious Insert (Some Random) Results Yes Yes Yes Yes x x Implicit dictionary O(n) Munro, Suwanda (1980) O(log2 n) Munro (1986) O(log2 n/loglog n) Franceschini, Grossi, Munro, Pagli(2004) 13