An implementation of a minheap. Starting with an empty array, you can push values whenever you want, and popping will remove and return the smallest value in the heap. It runs in logarithmic time, so a heap with a million elements needs to loop at most 20 times! These functions work with any type of array, including strings.