Heap Implementation using PriorityQueue in Java
-
Algorithms and Data Structures: TheAlgorist.com
-
System Design: DistributedComputing.dev
-
Low Level Design: LowLevelDesign.io
-
Frontend Engineering: FrontendEngineering.io
You definitely need to have a solid understanding of the internals of Heap data structure and different Heap operations as discussed in:
- Heap Fundamentals
- Heap: GetMax() / GetMin(), DeleteMax() / DeleteMin() and Insert()
- Heapify
- Heap Sort
This is a Premium content.
Please subscribe to Algorithms course to access the code.
- Did you notice how we used Heap to sort an array ? It is one of the many utilities of heap data structure. It is an O(NlogN) operation as discussed inline in the code.
More Application of Priority Queue:
The below simple code implements the following using Priority Queue:
- A doctor sees emergency patients before seeing a non-emergency patients. But if there are more than one emergency patients, the patient with lower id is seen first. Implement this with Priority Queue.
This is a Premium content.
Please subscribe to Algorithms course to access the code.
Instructor:
If you have any feedback, please use this form: https://thealgorists.com/Feedback.


