HEAPSORT LIKE ALGORITHM BUT NOT THE IDENTICAL ONE