Skip to content

Instantly share code, notes, and snippets.

View guneyozsan's full-sized avatar
👶
Dad

Guney Ozsan guneyozsan

👶
Dad
View GitHub Profile
@guneyozsan
guneyozsan / heap.py
Last active January 8, 2020 20:36 — forked from showell/heap.py
heapsort in Python
def swap(a, i, j):
a[i], a[j] = a[j], a[i]
def is_heap(a):
n = 0
m = 0
while True:
for i in [0, 1]:
m += 1
if m >= len(a):