அல்கோரிதம்heap

Heap structure

TT
Testlaa Team
May 14, 20261 min read

Min-heap — heapify down.

Try this in Python

import heapq

h = [5, 1, 3]
heapq.heapify(h)
print(h[0], h)

Key takeaways

  • heapq min; negate max.
  • heappushpop.
  • Tie order arbitrary.

Tags:

HeapsPythonமாணவர்கள்