9.Heaps
This section explains the concept, its importance, and when to use it.
9.Heaps
PRIORITY QUEUES
It is an abstract data type such as stack or queue
Integer values as priorities
Operations
The algorithmic approach and key insights for solving this problem.
Use Cases: - The concept of priority queues naturally suggest a sorting algorithm
HEAPS
It is baiscally a binary tree
1.) Complete -> we construct the heap from left to right across each row // of course the last row may not be completely full
Represent heap as array
Deletion: Remove operation
Use Cases: - Comparison-based sorting algorithm
Running time
Similar to a binary heap but also supports quick merging of two heaps
Faster than the classic binary heap
Time complexities