3 Commits

Author SHA1 Message Date
cc06e5fbdb
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 to the heap class

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

Note: 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).

Another solution is to add level as a parameter to _printIndented:

- void _printIndented(int index, int level, void visit(int, int));
2024-05-28 18:59:23 -07:00
eb1cf4176f
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.
2024-05-28 18:41:58 -07:00
0ca7ce28fd
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:

- Heap.h
- Heap.cpp
- main.cpp

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

- insertHeap
- deleteHeap
- _reHeapUp
- _reHeapDown
2024-05-28 18:33:44 -07:00