Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gap O(1) 1234567891011121314151617 AJCGDBFHE List Order Maintenance 1 EBHDCAFG Insert(x,y)Insert y after x Order(x,y)Returns if x is to the left of y I.

Similar presentations


Presentation on theme: "Gap O(1) 1234567891011121314151617 AJCGDBFHE List Order Maintenance 1 EBHDCAFG Insert(x,y)Insert y after x Order(x,y)Returns if x is to the left of y I."— Presentation transcript:

1 gap O(1) AJCGDBFHE List Order Maintenance 1 EBHDCAFG Insert(x,y)Insert y after x Order(x,y)Returns if x is to the left of y I Insert(D,I) Monotonic List Labeling Insert(x,y)Insert y after x 18 x y Each node an integer label Relabel nodes on insertion Density Maintenance File Insert(i,x)Insert x at postion i Shift elements on insertion Build data structure

2 [P. Dietz, Maintaining Order in a Linked List, ACM Conference on Theory of Computing, , 1982] [P. Dietz, J. Seiferas, J. Zhang: A Tight Lower Bound for On-line Monotonic List Labeling. Scandinavian Workshop on Algorithm Theory, , 1994] 2 [P. Dietz, D. Sleator, Two algorithms for maintaining order in a list, ACM Conference on Theory of Computing, , 1987] [A. Tsakalidis, Maintaining Order in a Generalized Linked List. Acta Informatica 21: , 1984] List Order Maintenance Query and Insert O(1) Monotonic List Labeling [D. Willard, Maintaining Dense Sequential Files in a Dynamic Environment, ACM Conference on Theory of Computing, , 1982] [P. Dietz, J. Zhang: Lower Bounds for Monotonic List Labeling. Scandinavian Workshop on Algorithm Theory, , 1990] Max label O(n) (log 2 n) relabelings Max label O(n k ) (log n) relabelings Applications [G. Brodal, R. Fagerberg, R. Jacob, Cache-Oblivious Search Trees via Binary Trees of Small Height, ACM-SIAM Symposium on Discrete Algorithms, pages 39-48, 2002] [J. Driscoll, N. Sarnak, D. Sleator, R. Tarjan, Making Data Structures Persistent, Journal of Computer and System Sciences, 38(1), , 1989]

3 3 Amortized O(log 2 n) Density Maintenance AJCGDBFHE AJKCGDBFHE density 5/8 4/4 level before after Threshold = 1/(2log n) Level i node overflows if density > 1-i Insert redistribute lowest non-overflowing ancestor a child requires fraction insertions before next overflow amoritzed insertion cost = #levels 1 / = O(log 2 n) redistribute Insert(6,K) 3/2 2/1 redistribution threshold 4/8 5/8 6/8 7/8 1

4 4 Amortized O(log 2 n) Density Maintenance AJCGDBFHE AJKCGDBFHE density 5/8 4/4 level before after Threshold = 1/(2log n) Level i node overflows if density > 1-i Insert redistribute lowest non-overflowing ancestor a child requires fraction insertions before next overflow amoritzed insertion cost = #levels 1 / = O(log 2 n) redistribute Insert(6,K) 3/2 2/1 redistribution threshold 4/8 5/8 6/8 7/8 1 List Order Maintenance Max label O(n) Amortized O(log 2 n) relabelings / insertion

5 5 Amortized O(log n) List Relabelings AC ACK 3/8 2/4 level before after Level i node overflows if density > (2/3) i Insert redistribute lowest non-overflowing ancestor log 4/3 n levels max label 2 log 4/3 n n 2.41 a child requires 1/2 fraction insertions before next overflow amoritzed insertion cost = #levels 3 = O(log n) 2/3 1/2 + implies max label n 1+O( ) redistribute Insert(C,K) 2/2 2/1 redistribution threshold 16/81 8/27 4/9 2/3 1 density 3/16

6 6 Amortized O(log n) List Relabelings [P. Dietz, D. Sleator, Two algorithms for maintaining order in a list, ACM Conference on Theory of Computing, , 1987] i w i = i w 2i = i = 1 while w 2i 4 w i do i = i +1 Relabel uniformly 2i area Only relabels to the right Relabeling area k : w k = (k 2 ) Requires labels mod O(n 2 )

7 7 Monotonic List Labeling O(log N) easy insertions Insert(x,y)Label y = (left + right)/2 Can perform log N insertions without relabeling 60 x y N0

8 the list Amortized O(1) List Order Maintenance Amortized O(log 2 n) Density Maintenance two-level bucket of degree [log n..2log n] and keys [0..n 2 ] top-tree of size n/log 2 n... Insertion – create and label new leaf – split nodes of degree > 2log n and relabel with gap n – insert in top tree

9 the list Amortized O(1) List Order Maintenance Amortized O(log 2 n) Density Maintenance two-level bucket of degree [log n..2log n] and keys [0..n 2 ] top-tree of size n/log 2 n... Insertion – create and label new leaf – split nodes of degree > 2log n and relabel with gap n – insert in top tree Worst-case [Willard 1982] + incremental insertion into top tree + incremental splitting of bucket nodes + every O(log 2 n)th operation split largest bucket largest bucket size O(log 3 n) three Worst-case

10 10 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 x9x9 x 10 x 11 x 12 xnxn... a5a5 a 11 a 12 a9a9


Download ppt "Gap O(1) 1234567891011121314151617 AJCGDBFHE List Order Maintenance 1 EBHDCAFG Insert(x,y)Insert y after x Order(x,y)Returns if x is to the left of y I."

Similar presentations


Ads by Google