insertion in min heap in c code example
Example 1: 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 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