min heap example
Example 1: min heap in c++
priority_queue <int, vector<int>, greater<int>> minHeap;
Example 2: min heap insertion
Williams Algorithm: top downwhile not end of array, if heap is empty, place item at root; else, place item at bottom of heap; while (child > parent) swap(parent, child); go to next array element; end
Example 3: min heap insertion
Williams Algorithm: top downwhile not end of array, if heap is empty, place item at root; else, place item at bottom of heap; while (child < parent) swap(parent, child); go to next array element; end