def build_heap(seq):
 n = (len(seq) - 1)
 for i in range((n // 2), (-1), (-1)):
  max_heapify(seq, i, n)

def build_heap ( seq ) : n = ( len ( seq ) - 1 ) for i in range ( ( n // 2 ) , ( - 1 ) , ( - 1 ) ) : max_heapify ( seq , i , n )
continously calls max_heapify on the list for each subtree .