Computer Science and Binary Tree Q1. You are given a complete binary tree with arbitrary values stored in an array.
It is not a binary search tree and it is not a heap. Your job is to convert it into a heap. Write a program in rough C++ code below to convert it into a max heap.
Computer Science and Binary Tree and the Rough Code
If you call a method within your program, you should also write the complete rough code of that method below your program.
Q2. Show how your program would work step by step using the following array of arbitrary values as a complete binary tree example.
Q3 Write a complete C++ program that implements a heap in an integer array of size 50.
Computer Science and Binary Tree Essay Research Guidelines
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.
Q4. Given the data as below, implement it as a binary search tree insidean array. Assume the data is arriving in this order to build the tree.