Lab 12 V3
Lab 12 V3
Lab 13
Topic Max Heap
Min Heap
Heap Sort
The basic purpose of this lab is to implement Max Heap, Min Heap, Heap Sort and
Objective test its Applications
Instructions:
• Indent your code.
• Use meaningful variable names.
• Plan your code carefully on a piece of paper before you implement it.
• Name of the program should be same as the task name. i.e. the first program should be
Task_1.cpp
• void main() is not allowed. Use int main()
• You have to work in multiple files. i.e separate .h and .cpp files
• You are not allowed to use any built-in functions
• You are required to follow the naming conventions as follow:
o Variables: firstName; (no underscores allowed)
o Function: getName(); (no underscores allowed)
o ClassName: BankAccount (no underscores allowed)
Implement a Min Heap using an array and support the insertion operation. Write a function to insert a
new element into the Min Heap while maintaining the heap property.
Requirements:
int *heapArray;
int capacity;
int heapSize;
Functions for MinHeap class:
Task 2
Implement a Max Heap using an array and support the insertion operation. Write a function to insert a
new element into the Max Heap while maintaining the heap property.
Requirements:
int *heapArray;
int capacity;
int heapSize;
Task 3
Implement a Min Heap using an array and support the deletion operation. Write a function to remove
the minimum element from the Min Heap while maintaining the heap property.
Requirements:
int *heapArray;
int capacity;
int heapSize;
Task 4
Implement a Max Heap using an array and support the deletion operation. Write a function to remove
the maximum element from the Max Heap while maintaining the heap property.
Requirements:
int *heapArray;
int capacity;
int heapSize;