Skip to content

stack / heap [terminology]

Terminology

Usage

  • Keep these names rather than abbreviating them.
  • They identify both the data structure and its algorithmic behavior.
  • Use stack for LIFO processing and heap for priority-based processing.
heap = []
heapq.heappush(heap, (node.val, i, node))