Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 19, Problem 1P

(a)

Program Plan Intro

Explain the assumption that Line 7 can be performed in O(1) actual time.

(a)

Expert Solution
Check Mark

Explanation of Solution

For performing line 7, the time taken is proportional to the number of children does x have. For adding each child in the root list requires to update the parent’s pointer to NULL instead of x.

Therefore, the updating of parent pointer to x is wrong in this assumption.

(b)

Program Plan Intro

Give anupper bound on the actual time of PISANO-DELETE, when node x is not inH.min .

(b)

Expert Solution
Check Mark

Explanation of Solution

An actual cost of bounded by x.degree and updating all children of x takes constant time so, the actual time of PISANO-DELETE is O(x.degree+c) , where c is number of calls to CASCADING-CUT procedure.

Hence, the upper bound on the actual time is O(x.degree+c) .

(c)

Program Plan Intro

Use PISANO-DELETE( H,x ), describe that the node x is not a root, bound the potential of H’ in terms of x.degree, c, t ( H ) and m ( H ).

(c)

Expert Solution
Check Mark

Explanation of Solution

Explanation:

As given CASCASDING-CUT rule we know that if it marked more than one node then m(H')m(H)+1 .

If the children increased from the previous that x had then equation will become t(H')=x.degree+t(H) .

Now taking the consideration and according to question, combiningthese expressions the bound of potential is − ϕ(H')t(H)+x.degree+2(1+m(H)).

(d)

Program Plan Intro

Conclude that the amortized time for PISANO-DELETE is asymptotically no better than for FIB-DELETE, even when x H.min.

(d)

Expert Solution
Check Mark

Explanation of Solution

The amortized time for PISANO-DELETE is asymptotically is θ(x.degree)=θ(lgn) .

When x H.min then the time taken in FIB-DELETE is also θ(lgn) which same as the time is taken for PISANO-DELETE.

Therefore, the amortized time for PISANO-DELETE is asymptotically no better than for FIB-DELETE, even when x H.min.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
There is an algorithm for making the heap complete:1. Remove the node at the root.2. Move the node in the last position to the root.3. Trickle the last node down until it is below.When this algorithm is applied continually, the data is removed from the heap in sorted order. Write the code for the Remove and TrickleDown methods in c#.
A good loop invariant would be “The entire tree is a heapexcept that nodei might not be greater or equal to both of its children. As well, thevalue of i’s parent is at least the value of i and of i’s children.” When i is the root,this is the precondition. The algorithm proceeds as in the recursive algorithm.Node i follows one path down the tree to a leaf. When i is a leaf, the whole tree isa heap.Write algorithm Heapify(r )
What is the difference between a min heap search and a binary tree search? Is it feasible to generate a sorted list of the keys of a binary tree in the amount of time specified by O(n)? How much time does it take to compile a list of the keys in a heap that has been sorted?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education