70 likes | 209 Views
Unified Access Bound. Dictionary : Insert ( x ), Delete ( x ), Search ( x ) Comparison model. Solution 1 : Balanced search tree Solution 2 : Unordered linked list. O(log n ) O( n ). move-to-front. 2. 7. 4. 1. 9. 5. 3. Search (2), Search (2), Search (2).
E N D
Unified Access Bound • Dictionary: Insert(x), Delete(x), Search(x) • Comparison model • Solution 1: Balancedsearchtree • Solution 2: Unorderedlinked list • O(log n) • O(n) move-to-front 2 7 4 1 9 5 3 Search(2), Search(2), Search(2) , Search(5), Search(5), Search(5) 5 2 7 4 1 9 3 • [D.D. Sleator, R.E. Tarjan, Amortized Efficiency of List Update Rules, Proc. 16th Annual ACM Symposium on Theory of Computing, 488-492, 1984] The paperinitiated the study of competitivenesanalysis of online algorithmsfor list ordering, search-trees, pagingalgorithms, ... (move-to-front is 2-competitive) [M. Bădoiu, R. Cole, E.D. Demaine, J. Iacono, A unified access bound on comparison-based dynamic dictionaries, Theoretical Computer Science, 382(2), 86-96, 2007]
Access sequences - examples X1 = 1, 2, 3, ..., n, 1, 2, 3, ..., n, 1, 2, 3, ... X2 = 1, n, 1, n, 1, n, ... X3 = 1, n/2, 2, n/2+1, 3, n/2+2, ..., n/2, n, 1, ...
Access sequenceX = (x1, x2, ..., xm) Finger searchtree di(f,xi) di(xi,xi-1) Sorted list f xi xi-1 Move-to-front list xi Static optimal O(log (1/p(xi))) Sequential-accessbound O(1) Static finger bound O(log di(f, xi)) Dynamic finger bound O(log di(xi, xi-1)) Working set bound O(log wi(xi)) Unifiedbound O(minySi log(wi(y)+di(xi, y))) wi(xi)
Splaytrees (amortized) 1 2 1 3 1 Open 1 [D.D. Sleator, R.E. Tarjan, Self-Adjusting Binary Search Trees, J. ACM 32(3), 652-686, 1985] 2 [R.E. Tarjan, Sequential access in play trees takes linear time. Combinatorica 5(4), 367-378, 1985] 3 [R. Cole, B. Mishra, J.P. Schmidt, A. Siegel, On the Dynamic Finger Conjecture for Splay Trees. Part I: Splay Sorting log n-Block Sequences. SIAM J. Computing, 30(1), 1-43, 2000] [R. Cole, On the Dynamic Finger Conjecture for Splay Trees. Part II: The Proof. SIAM J. Computing, 30(1), 44-85, 2000] Static optimal O(log (1/p(xi))) Sequential-accessbound O(1) Static finger bound O(log di(f, xi)) Dynamic finger bound O(log di(xi, xi-1)) Working set bound O(log wi(xi)) Unifiedbound O(minySilog(wi(y)+di(xi, y)))
Staticoptimality • Split ½ weightbothchildren • Depth dsubtreeweight (½)d • Depthxi log(1/p(xi)) • Static optimal D 1.0 G A 0.23 0.17 B F H 0.07 0.11 0.10 C J E 0.02 0.03 0.04 I 0.01 Construction: Computeprefix sums + Exponentialsearch O(n) [T.C. Hu, A.C. Tucker, Optimal computer search trees and variable-length alphabetic codes, SIAM Journal on Applied Mathematics 21 (4), 514–532, 1971] [D.E. Knuth, Optimum binary search trees, ActaInformatica 1, 14–25, 1971]
Working-setstructure [M. Bădoiu, R. Cole, E.D. Demaine, J. Iacono, A unified access bound on comparison-based dynamic dictionaries, Theoretical Computer Science, 382(2), 86-96, 2007] T3 T2 T1 T0 L1 L2 L3 L0 wj Search(T0) + ∙∙∙ + Search(Ti) = log(220) + ∙∙∙ + log(22i) 4∙log(22i-1) 4∙log wj L = L0+L1+ ∙∙∙ = move-to-front list |Li|=22i Ti = searchtree over Li Insert, Delete = O(log n), Search = O(log wj)
Unifiedstructure [M. Bădoiu, R. Cole, E.D. Demaine, J. Iacono, A unified access bound on comparison-based dynamic dictionaries, Theoretical Computer Science, 382(2), 86-96, 2007] Searchtrees of a subsetof the elements T3 T2 T1 ( ) T0 Finger searchtreeover all elements Lemma 7 wi(y) 22k and x and y rank distance 22k, thenxwithin rank distance (k+4)22kof somey’T0∙∙∙Tk F predecessor successor