Understanding a heap
One of the most common priority queue implementations uses a special type of tree called a heap. It is just a tree that follows a special heap property. It can be implemented using a binary tree (where each node has at most two children) or an N-ary tree (where each node has at most N children), but we will only learn its binary tree implementation. A heap implemented using a binary tree is also called a binary heap, and its heap property is as follows.
- The tree is a complete binary tree.
- It follows the heap ordering property
Complete binary tree
Liking the course? Check our discounted plans to continue learning.