Heap and Priority Queue 101
- June 11, 2017
- Venkatesh Thallam
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...