Properties of Heap
Structural Property: This property states that it should be A Complete Binary Tree.
For example:
Ordering Property: The heap should follow either Max-heap or Min-heap Property.
- If it is Min-heap, the parent node should be less than the child node and
- In the case of a Max-heap, the parent node should be greater than the child node.
These rules should be followed at each level but the order of bottom child nodes can change we can understand it with an example(We are taking Max heap as an example):