Heap
Basically like a binary tree, representing an array. The indices count from left to right down the different levels of the tree
Max-Heap
Has the largest element as the root and no parent node can have child nodes larger than itself.
The left child of a node at index i in a heap will always be at index…
2i
The right child of a node at index i in a heap will always be at index…
2i + 1
Viewing a heap as a tree, we define the height of a node in a heap to be
the number of edges on the longest simple downward path from the node to a leaf
Height of a binary tree with n elements
O(lgn)