Analysis Link/cut tree




1 analysis

1.1 heavy-light decomposition

1.1.1 o(log n) upper bound
1.1.2 improving o(log n) upper bound







analysis

cut , link have o(1) cost, plus of access. findroot has o(log n) amortized upper bound, plus cost of access. data structure can augmented additional information (such min or max valued node in subtrees, or sum), depending on implementation. path can return information in constant time plus access bound.


so remains bound access find our running time.


access makes use of splaying, know has o(log n) amortized upper bound. remaining analysis deals number of times need splay. equal number of preferred child changes (the number of edges changed in preferred path) traverse tree.


we bound access using technique called heavy-light decomposition.


heavy-light decomposition

this technique calls edge heavy or light depending on number of nodes in subtree.



s
i
z
e
(
v
)


{\displaystyle size(v)}

represents number of nodes in subtree of v in represented tree. edge called heavy if size(v) >  ⁄2 size(parent(v)). can see each node can have @ 1 heavy edge. edge not heavy edge referred light edge.


the light-depth refers number of light edges on given path root vertex v. light-depth ≤ lg n because each time traverse light-edge decrease number of nodes @ least factor of 2 (since can have @ half nodes of parent).


so given edge in represented tree can of 4 possibilities: heavy-preferred, heavy-unpreferred, light-preferred or light-unpreferred.


first prove



o
(

log

2



n
)


{\displaystyle o(\log ^{2}n)}

upper bound.


o(log n) upper bound

the splay operation of access gives log n, need bound number of accesses log n prove o(log n) upper bound.


every change of preferred edge results in new preferred edge being formed. count number of preferred edges formed. since there @ log n edges light on given path, there @ log n light edges changing preferred.


the number of heavy edges becoming preferred can



o
(
n
)


{\displaystyle o(n)}

given operation,



o
(
log

n
)


{\displaystyle o(\log n)}

amortized. on series of executions can have n-1 heavy edges become preferred (as there @ n-1 heavy edges total in represented tree), on number of heavy edges become preferred equal number of heavy edges became unpreferred on previous step. every heavy edge becomes unpreferred light edge must become preferred. have seen number of light edges can become preferred @ log n. number of heavy edges become preferred m operations



m
(
log

n
)
+
(
n

1
)


{\displaystyle m(\log n)+(n-1)}

. on enough operations (



m
>
n

1


{\displaystyle m>n-1}

) averages



o
(
log

n
)


{\displaystyle o(\log n)}

.


improving o(log n) upper bound

we have bound number of preferred child changes @



o
(
log

n
)


{\displaystyle o(\log n)}

, if can show each preferred child change has cost o(1) amortized can bound access operation @



o
(
log

n
)


{\displaystyle o(\log n)}

. done using potential method.


let s(v) number of nodes under v in tree of auxiliary trees. potential function



Φ
=



v


log


s
(
v
)



{\displaystyle \phi =\sum _{v}\log {s(v)}}

. know amortized cost of splaying bounded by:







c
o
s
t
(
s
p
l
a
y
(
v
)
)

3

(
log


s
(
r
o
o
t
(
v
)
)


log


s
(
v
)

)

+
1


{\displaystyle cost(splay(v))\leq 3\left(\log {s(root(v))}-\log {s(v)}\right)+1}



we know after splaying, v child of path-parent node w. know that:







s
(
v
)

s
(
w
)


{\displaystyle s(v)\leq s(w)}



we use inequality , amortized cost of access achieve telescoping sum bounded by:







3

(
log


s
(
r
)


log


s
(
v
)

)

+
o
(

number of preferred child changes

)


{\displaystyle 3\left(\log {s(r)}-\log {s(v)}\right)+o({\text{number of preferred child changes}})}



where r root of represented tree, , know number of preferred child changes



o
(
log

n
)


{\displaystyle o(\log n)}

. s(r) = n, have



o
(
log

n
)


{\displaystyle o(\log n)}

amortized.







Comments

Popular posts from this blog

History The Vandals

Causes Portuguese conquest of the Banda Oriental

Publications Daniel Kolak