HOMEWORK 3: CS 425 (THEORY OF ALGORITHMS) DUE DATE: September 30, 2020, 7 pm 1. Build a MaxHeap using the following data. Show all steps, make a table similar to all other problems. Keep a column for...

1 answer below »
There is no referencing style. I would like Neha and she can extend the current order until Monday. We are suppose to use visual studios. (The system is not allowing me to change the due date from today).


HOMEWORK 3: CS 425 (THEORY OF ALGORITHMS) DUE DATE: September 30, 2020, 7 pm 1. Build a MaxHeap using the following data. Show all steps, make a table similar to all other problems. Keep a column for runtime. The data given are as below: 67, 39, 100, 54, 200, 80, 91, 198 2. Write a C++ Program to implement the Build MaxHeap Algorithm. Use the pseudocode given in the notes. 3. Using the MaxHeap constructed in Problem 1, show (a) How you would you add 178 and (b) then show how you would delete the second node. 4. Using the max heap as given below: 100, 90, 70, 40, 15, 65 Illustrate Heap sort algorithm. 5. Write a Program in C++ to implement Heap Sort Algorithm. All the problems should be submitted together within a single file. I would prefer if you use MS word to type in the data for problem 1, 3, 4 and for programming using repl or visual studio and copy and paste the program to the word document.
Answered Same DayOct 10, 2021

Answer To: HOMEWORK 3: CS 425 (THEORY OF ALGORITHMS) DUE DATE: September 30, 2020, 7 pm 1. Build a MaxHeap...

Neha answered on Oct 11 2021
153 Votes
HOMEWORK 3: CS 425 (THEORY OF ALGORITHMS)
DUE DATE: September 30, 2020, 7 pm
1. Build a MaxHeap us
ing the following data. Show all steps, make a table similar to all other problems. Keep a column for runtime.
The data given are as below:
67, 39, 100, 54, 200, 80, 91, 198
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
2. Write a C++ Program to implement the Build MaxHeap Algorithm. Use the pseudocode given in the notes.
#include
using namespace std;

void heapify(int arr[], int n, int i) {
int largest = i;
int left = 2 * i + 1;
int right = 2 * i + 2;

if (left < n && arr[left] > arr[largest])
largest = left;

if (right < n && arr[right] > arr[largest])
largest = right;

if (largest != i) {
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here