Question: Write a pseudocode function which takes two parameters: heap1 and heap2, and returns an integer. The function should return the 3rd largest number contained in

Write a pseudocode function which takes two parameters: heap1 and heap2, and returns an integer. The function should return the 3rd largest number contained in both heaps. Both heap1 and heap 2 are maxheaps containing integers, and both heaps have at least 3 elements. For example, if heap1 contains 10,7,6,4,1 and heap2 contains 8,4,3 your function should return 7 . If heap 1 contains 10,7,4 and heap2 contains 5,4,3 your function should return 5 . It is acceptable if heap1 and heap2 are changed during the function call. Assume you have a class Heap implemented which implements the following heap functions discussed in the videos and textbook (and only the following functions). +isEmpty(): boolean +getNumberofNodes(): integer +add(newEntry: ItemType): boolean +peek(): ItemType +remove (): boolean oronze (heap1: Heap, heap2: Heap): integer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
