Beispiel #1
0
def heap_sort_2(arr, n):
    heap = MaxHeap()
    heap.heapify(arr)

    for j in reversed(range(n)):
        arr[j] = heap.remove()
Beispiel #2
0
def heapSort2(nums):
    n = len(nums)
    maxheap = MaxHeap()
    maxheap.heapify(nums)
    for i in xrange(n - 1, -1, -1):
        nums[i] = maxheap.extractMax()