c++ structure

0 comments

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

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}