Heap and Priority Queue 101
- June 11, 2017
- by
- Venkatesh Thallam
Heap
Heap: A heap is a partially ordered tree, typically a binary tree. Heaps use the index starting typically from ‘i’.
When represented as an array, the parent element can be found at i/2, left child at 2*i, right child at 2 *i+1, where āiā is the index of the location.
A āNā element heap contains...