refactor heapsort to use swap in utils/helpers