adjustable navigation pile
play

Adjustable navigation pile Jyrki Katajainen 1 Tetsuo Asano 2 Omar - PowerPoint PPT Presentation

20 November, 2015 ARCO Meeting, Lyngby Adjustable navigation pile Jyrki Katajainen 1 Tetsuo Asano 2 Omar Darwish 3 Amr Elmasry 4 Fabio Vitale 5 1 University of Copenhagen 2 Japan Advanced Institute for Science and Technology 3 Max-Planck Institute


  1. 20 November, 2015 ARCO Meeting, Lyngby Adjustable navigation pile Jyrki Katajainen 1 Tetsuo Asano 2 Omar Darwish 3 Amr Elmasry 4 Fabio Vitale 5 1 University of Copenhagen 2 Japan Advanced Institute for Science and Technology 3 Max-Planck Institute for Informatics 4 Alexandria University 5 University of Lille These slides are available via my research information system http://www.diku.dk/~jyrki/Myris/slides-by-year.html

  2. Restricted SAM SAM: sequential-access machine input tape; read only work tape; read write output tape; write only one-way read head two-way read/write head one-way write head

  3. Restricted RAM RAM: random-access machine input; read only ; random access work space; read write ; random access output; write only ; sequential access one-way printing

  4. Sch¨ onhage et al.’s order notation N : problem size a number sets of functions O (lg N ) ! lg N O Ω(lg N ) ! read: bounded O ! read: an unspecified constant O silly question: What is 5 N 2 + 20 N ? A number or a function?

  5. Space-time trade-offs input size: N (measured in elements) working space: S ( N ) bits ; S ( N ) ≥ lg N running time: T ( N ) → − − − − − expected: S ( N ) = = ⇒ T ( N ) − − − − − → typical question: What is the fastest algorithm for the problem P of size N when working space of S ( N ) bits is available?

  6. Sorting input size: N (measured in elements) working space: S ( N ) bits ; S ( N ) ≥ lg N running time: T ( N ) ! N lg N comparison-based lower bound: T ( N ) ≥ O ! N 2 [Beame 1991] S ( N ) · T ( N ) ≥ O ! N 2 /S ( N )+ O ! N lg( S ( N )), for any [Pagter & Rauhe 1998] T ( N ) ≤ O ! lg N S ( N ) ≥ O

  7. Questions ! N 2 / lg N worst-case time (1) How would you sort N elements in O ! lg N bits is available? when only working space of O ! N lg N worst-case time when (2) How would you sort N elements in O ! N/ lg N bits is available? working space of O optimally adjustable: How to achieve optimal worst-case running ! N 2 /S ( N ) for every S ( N ) ∈ [ O ! lg N . . O ! N/ lg N ]? time O

  8. Our answer procedure : pilesort input : A [0 . . N − 1]: read-only array of N elements S : workspace size P ← navigation - pile ( A, S ) for i ∈ { 0 , 1 , . . . , N − 1 } : P. insert ( i ) while | P | > 0: j ← P. minimum () P. extract ( j ) print ( A [ j ])

  9. Tournament tree S := 2 ⌈ lg S ⌉ ¯ 1 • invariant: index to 2 the min inside the • buckets covered 4 5 • • 8 9 10 11 • • • • 0 1 2 3 ¯ · · · S buckets � elements per bucket � N/ ¯ S # bits: about 2¯ S · lg N ; a log factor too much

  10. procedure : path - update input : bucket - start : index of the beginning of the bucket changed bucket - min : index of the minimum alive element within this bucket data : N : number of elements ¯ S : workspace size rounded to a power of 2 A [0 . . N − 1]: read-only array of elements T [1 . . 2¯ S − 1]: array of indices from { none , 0 , 1 , . . . , N − 1 } current ← ¯ � N/ ¯ S + bucket - start / S � T [ current ] ← bucket - min � lg ¯ S, lg ¯ � : for ℓ ∈ S − 1 , . . . , 1 parent ← ⌊ current / 2 ⌋ sibling ← if current mod 2 = 0: this + 1 else this − 1 Reestablishing the invariants if T [ sibling ] = none : after a bucket gets a new min T [ parent ] ← T [ current ] else if T [ current ] = none : T [ parent ] ← T [ sibling ] else if A [ T [ current ]] < A [ T [ sibling ]]: T [ parent ] ← T [ current ] else : T [ parent ] ← T [ sibling ] current ← parent

  11. Operations insert : extract : • add the new element to the • find the new min of the last bucket bucket where a change was • update the min of that made bucket, if necessary • run path - update for this bucket • run path - update for this bucket worst-case running time: worst-case ! N/ ¯ ! lg ¯ O S + O S running time: ! lg ¯ O S insert improved: • divide the work of path - update � insertions � N/ ¯ for S

  12. Navigation pile 1 invariant: relative 001 index of the bucket 2 containing the min 01 in the covered set 4 5 1 1 0 1 2 3 ¯ · · · S buckets � elements per bucket � N/ ¯ S Bits stored in breadth-first order in a bit vector 2 · 1 + ¯ ¯ 4 · 2 + ¯ S S S 8 · 3 + . . . ≤ 2¯ # bits: S ! lg ¯ S · N/ ¯ update : O S ; a log factor too slow

  13. Quantile thinning bucket | quantile quantile size ⌊ i/ 8 ⌋ b/ 16 1010 | 1101 ⌊ i/ 4 ⌋ b/ 8 010 | 110 ⌊ i/ 2 ⌋ b/ 4 10 | 11 i b/ 2 0 | 1 ¯ S buckets � elements per bucket � N/ ¯ b := S # bits: ≤ 4¯ S

  14. Running time per update ! N/ ¯ new bucket min: O S path - update : ( 1 ! )+( 1 ! )+( 1 2 N/ ¯ 4 N/ ¯ 8 N/ ¯ ! N/ ¯ ! lg ¯ ! )+ . . . ≤ O S + O S + O S + O S + O S • • • ! N/ ¯ ! lg ¯ ! , if wanted insert : O S + O S ; can be improved to O ! N/ ¯ ! lg ¯ extract : O S + O S minimum : can be supported in O worst-case time by maintaining a ! cursor to the overall min

  15. Remarks slow! fun! application: In a word RAM, an adjustable navigation pile that uses ! N/ lg N bits of extra space supports insert in O ! worst-case time O ! lg N worst-case time involving at most O and extract - min in O ! element moves . open: For almost any problem, the exact space-time trade-off is not known in the restricted RAM model.

  16. Further reading [Beame 1991] sorting lower bound [Pagter & Rauhe 1998] sorting upper bound [Sch¨ onhage et al. 1994] order notation [Knuth 2011] Vol. 4A, bit manipulation, mentions navigation piles [Katajainen & Vitale 2003] original N -bit version [Asano et al. 2013] conference version [Darwish et al. 2015] journal version http://arxiv.org/abs/1510.07185 [Elmasry et al. 2014] selection [Elmasry et al. 2015] graph algorithms [Elmasry & Kammer 2015] geometric algorithms

Recommend


More recommend