c++ structure
User Generated
znnmnyv89
Computer Science
Description
please type in word documents thanks
Q1. Write a complete C++ program that implements a heap in an integer array of size 50. Implement the heap class with add and remove member methods and call the add method in the client code to add 15 randomly generated numbers to the heap. Show it works correctly by removing 5 values from it. These would be the 5 largest out of the 15 numbers stored in the heap.
Add a method that accepts a number between 0 and 49 and returns two data values. It uses the number as an index into the heap array and reports the data value stored. It also identifies and reports the data value stored at its parent node. Your program should report if any of these indices are empty or out of bounds.
Q2 Given the data as below, implement it as a binary search tree insidean array.Assume the data is arriving in thisorder to build the tree.
53, 62, 24, 12, 27, 73, 58
This question has not been answered.
Create a free account to get help with this and any other question!
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
The Chosen
by Chaim Potok
The Fault in Our Stars
by John Green
Of Mice and Men
by John Steinbeck
Ezperanza Rising
by Pam Muñoz Ryan
Anthem
by Ayn Rand
Notes from Underground
by Fyodor Dostoyevsky
A Separate Peace
by John Knowles
The President is Missing
by James Patterson, Bill Clinton
Alice in Wonderland
by Lewis Carroll