Data Abstract Structures Labuild a Max Heap CPP Project 10.6 Lab: Heap – Build a max-heap (of integers) This program will read integers from the keyboard,

Data Abstract Structures Labuild a Max Heap CPP Project 10.6 Lab: Heap – Build a max-heap (of integers)

This program will read integers from the keyboard, insert them into a max-heap, and display them as they are deleted from the heap. Most of the code is given:

Don't use plagiarized sources. Get Your Custom Essay on
Data Abstract Structures Labuild a Max Heap CPP Project 10.6 Lab: Heap – Build a max-heap (of integers) This program will read integers from the keyboard,
For $10/Page 0nly
Order Essay

Heap.h
Heap.cpp
main.cpp

Your task is to finish defining four function in Heap.cpp:

insertHeap
deleteHeap
_reHeapUp
_reHeapDown
10.7 Lab: Heap – Build a min-heap (of integers)

Change the previous lab to work with a min-heap instead of a max-heap.

This program will read integers from the keyboard, insert them into a min-heap, and display them as they are deleted from the heap. Most of the code is given:

Heap.h
Heap.cpp
main.cpp

Your task is to finish defining four function in Heap.cpp:

insertHeap
deleteHeap
_reHeapUp
_reHeapDow
10.8 Lab: Heap – Display Heap as an Indented List

Change the previous lab to display a min-heap as an indented list (level numbers included). In order to do this you will have to add two new member functions of the heap class

- void _printIndented(int index, void visit(int, int)); // A
- void printIndented(void visit(int, int)); // B

None: One function would be sufficient(A). However, to make the call simpler, a wrapper function (B) has been added (to “hide” the root of the heap).

10.9 Lab: Heap – Build min/max-heaps (of integers)

Generalize one of the previous labs to build a min-heap or a max-heap using the same heap functions. Hint: a pointer to a compare function. In main() you are passing either compareMin or compareMax to the insertHeap function:

minHeap.insertHeap(num, compareMin);
maxHeap.insertHeap(num, compareMax);

You also have to update the following functions in the Heap class:

bool insertHeap(int itemIn);
bool deleteHeap(int &itemOut);
void _reHeapUp(int lastndx);
void _reHeapDown(int rootndx);

This program will:

read integers from the keyboard and insert them into a min-heap and a max-heap
display the integers as they are deleted from the min-heap.
display the integers as they are deleted from the max-heap.

admin

Recent Posts

Economic Debate #3- Progressive Income Tax – The Homework Helper

Economic Debate- Progressive Income Tax For this Economic Debate, we are going to discuss the…

2 years ago

MKT 6120 – Marketing Management – Davis Learning Engagement #7

TOPIC: Going Global Discussion Thread 1 (initial post due Wednesday for full credit) Please note:…

4 years ago

jvjvjhvjhvhjvj

Assignment Topic This week will culminate in the creation of a narrated PowerPoint to create…

4 years ago

Students are supposed to select a technological organization of their choice.

The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…

4 years ago

Increases the risk of wildfires

you need to post your 2-page information flier to share with your Final Project Group.…

4 years ago

Statistics for Technology management

discussion: Discuss the methods used at your company to measure and ensure quality products and…

4 years ago