Implementation of a minheap