Min Heap or Max Heap
这篇文章以Min Heap为例
特征:parent<children, 所以root永远是最小的元素
Insertion:goes to the next empty spot and then bubble it up
Remove the min: 1. remove the min
2.replace with last node and then bubble down
Array Implementation
Parent index = (index-1)/2;
left child index = index*2+1;
right child index = index*2+2;
Priority Queue C++
empty();
size();
top();
push();
pop();
emplace();
swap();
Reference: