modify heap sort algorithm