مرتب سازی هرمی (Heap Sort) — به زبان ساده – فرادرس
مرتب سازی هرمی در پایتون. 1 # Python program for implementation of heap Sort 2 3 # To heapify subtree rooted at index i. 4 # n is size of heap 5 def heapify(arr, n, i): 6 largest = i # Initialize largest as root 7 l = 2 * i + 1 # left = 2*i + 1 8 r = 2 * i + 2 # right = 2*i + 2 9 10 # See if left child of root exists and is ...