Updating heap sort algorithm