made suitable changes to the heap_sort implementation