அல்கோரிதம்binary heap

Binary heap

TT
Testlaa Team
May 14, 20261 min read

Parent/child index formulas.

Try this in Python

def parent(i):
    return (i - 1) // 2

print(parent(5), parent(0))

Key takeaways

  • Indexing base consistent.
  • Height log n.
  • Complete tree.

Tags:

HeapsPythonமாணவர்கள்