Do We Have Enough Credits?
How many credits are paid from
a Find?
• We pay from the Find when
we (1) change rank groups
as we move up the path or
(2) reach the root
• How many rank groups are
there?
– There are at most log*n - 1
rank-groups (not counting
group 0, the singletons)
• Thus Find pays at most
log*n credits
How many credits are paid from
nodes?
• If node v pays then we know
– v is not a root (thus it’s rank
will no longer change)
– v’s parent is in the same
rank-group
– v is going to have a new
parent (with a higher rank)
due to path compression
• Thus v pays at most a
number of credits equal to
the number of different ranks
in its rank group
CS409 - Spring 2000
13