Question: Only do Part b) 2. [10 You are given a binary max-heap H and you will design the following two algorithms with different requirements. For

Only do Part b)
2. [10 You are given a binary max-heap H and you will design the following two algorithms with different requirements. For both algorithms you may assume that the size of H is at least 3, and that all elements in H have distinct values. (a) Design the EXTRACT-THIRD-LARGEST (H) algorithm which removes and returns the third largest element in H The worst-case runtime must be O(logn). Write the pseudocode of your algorithm and justify its correctness and worst-case runtime. (b) Design the GET-THIRD-LARGESTCH) algorithm which returns the third largest element in H without removing it. The worst-case time complexity of your algorithm must be as low as possible. Only the fastest possible algorithm will get full mark. Write the pseudocode of your algorithm and justify its correctness and worst-case runtime Note: For both designs you may use the following functions that we learned from the lecture as helper functions: BUBBLE-DOWN, EXTRACT-MAX, INCREASE-KEY and INSERT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
