19-1 Alternative implementation of deletion
Professor Pisano has proposed the following variant of the procedure, claiming that it runs faster when the node being deleted is not the node pointed to by .
cpp PISANO-DELETE(H, x) if x == H.min FIB-HEAP-EXTRACT-MIN(H) else y = x.p if y != NIL CUT(H, x, y) CASCADING-CUT(H, y) add x's child list to the root list of H remove x from the root list of Ha. The professor's claim that this procedure runs faster is based partly on the assumption that line 7 can be performed in actual time. What is wrong with this assumption?
b. Give a good upper bound on the actual time of when is not . Your bound should be in terms of and the number of calls to the procedure.
c. Suppose that we call , and let be the Fibonacci heap that results. Assuming that node is not a root, bound the potential of in terms of , , , and .
d. Conclude that the amortized time for is asymptotically no better than for , evenwhen .
a. It can take actual time proportional to the number of children that had because for each child, when placing it in the root list, their parent pointer needs to be updated to be instead of .
b. Line 7 takes actual time bounded by since updating each of the children of only takes constant time. So, if is the number of cascading cuts that are done, the actual cost is .
c. We examine the number of trees in the root list and the number of marked nodes of the resulting Fibonacci heap to upper-bound its potential. The number of trees increases by the number of children had (), due to line 7 of . The number of marked nodes in is calculated as follows. The first recursive calls out of the calls to unmarks a marked node (line 4 of invoked by line 5 of ). The final th call to marks an unmarked node (line 4 of ), and therefore, the total change in marked nodes is . Therefore, the potential of H' is
d. The asymptotic time is
which is the same asyptotic time that was required for the original deletion method.