Replaced old heapsort with new heapsort O(n*logn)