Skip to content

Instantly share code, notes, and snippets.

# python3
def parent_key_cal(key):
if key % 2 == 0:
parent_key = (key - 2)//2
else:
parent_key = (key - 1)//2
return parent_key
# python3
def parent_key_cal(key):
if key % 2 == 0:
parent_key = (key - 2)//2
else:
parent_key = (key - 1)//2
return parent_key