Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[C++] Pseudocode only Write a pseudocode function which takes two parameters: heap1 and heap2, and returns an integer. The function should return the 3rd largest

[C++] Pseudocode only

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 heap2 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 heap1 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 bronze(heap1: Heap, heap2: Heap): integer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions