Amortization Scheme for Union/Find
Credits charged
• one credit is charged for
each Union
• log*(n) credits are charged
for each Find
• n log*(n) credits are initially
charged to the set of nodes
• It’s clear that a total of
O(n log*n) credits are
charged for n operations
Credits paid
• one credit is paid to do a
Union
• for Find, we follow a path,
moving from each node v to
the parent of v
– Pay a credit from the
Find if v is the root, if the
parent of v is the root, or
if the parent of v is not in
v’s rank-group
– Pay a credit from v
otherwise
CS409 - Spring 2000
12