- Split the problem into sub problems such that their solutions can be used to construct the solution of the complete probelm
- Mostly used in optimization problems like max sub array sum, stock buy sell etc.
- Can't be used when there are more than one solution
- A binary heap is a binary tree i.e. each node must have two children. The tree is filled sequentially i.e. only the nodes at the end are allowed to have less than 2 children
- Heaps satifies the heap invariant i.e.
child nodes <= parent node
(max heap) orchild nodes >= parent nodes
(min heap) - In max heap, the root is the max element
- In min heap, the root is the min element
- Trees must not have cycle in a heap
- Use max heap for in place heap sort
- Use min heap to find the Kth largest elements or K largest elements