min_heap_sort implementation