one = [5, 8, 1, 70, 34, 43, 2, 86, 4, 90, 230, 3]
two = [6,45,87,23]
three = [5, 450, 230]
four = [7,6,10,23,12,5,5,3]
def list_to_heap(arr):
def f(m, i):
f = i * 2 + 1
s = i * 2 + 2
large = i
lim = len(m) - 1
if f = 0:
f(arr,n)
n -= 1
return arr
def heap(a):
res = list_to_heap(a)
b = [res[0]]
for i in range(len(a) - 1):
res = list_to_heap(res[1:])
b.insert(0, res[0])
return b
print(*heap(one))
print(*heap(two))
print(*heap(three))
print(*heap(four))
1 2 3 4 5 8 34 43 70 86 90 230 6 23 45 87
5 230 450
3 5 5 6 7 10 12 23