Question: To analyze MAX - HEAPIFY, let T ( n ) be the worst - case running time that the procedure takes on a subtree of
To analyze MAXHEAPIFY, let be the worstcase running time that the
procedure takes on a subtree of size at most For a tree rooted at a given node
the running time is the time to fix up the relationships among the elements
and plus the time to run MAXHEAPIFY on a
subtree rooted at one of the children of node assuming that the recursive call oc
curs The children's subtrees each have size at most see Exercise and
therefore we can describe the running time of MAXHEAPIFY by the recurrence
The solution to this recurrence, by case of the master theorem Theorem on
page is Alternatively, we can characterize the running time
of MAXHEAPIFY on a node of height as
Exercises
Using Figure as a model, illustrate the operation of MAxI on
the array ::
Show that each child of the root of an node heap is the root of a subtree containing
at most nodes. What is the smallest constant such that each subtree has at
most nodes? How does that affect the recurrence and its solution?
Starting with the procedure MAXHEAPIFY, write pseudocode for the procedure
MINI which performs the corresponding manipulation on a min
heap. How does the running time of MINHEAPIFY compare with that of MAX
HEAPIFY?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
