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

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Content

Related Tags