Question: Question 3 . Consider the following program: P . Initialize ( ) initializes the data structures. P . Insert ( ) inserts elements x in
Question Consider the following program:
PInitialize initializes the data structures.
PInsert inserts elements in
PExtractMax returns the maximum element of and deletes it from
PSize returns the number of elements in
Analyze the running time of Program assuming that is implemented as a MaxHeap.
Analyze the total number of time for both PInsert and PExtractMax operations. Note
that the time for Insert and ExtractMax is depended on the number of elements in
which changes over the running time of the algorithm. Operations PInitialize and PSize
take constant time. Show your work.
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
