Skip to content

Latest commit

 

History

History

README.md

Heaps

  • specialized complete binary tree
  • keys must satisfy they heap property
    • key at each node is at least as great as they keys stored w/in children
  • Use Heap when all you care about is the largest or smallest elements
    • don't need to support fast lookup for other elements
    • just max/min
  • Good for computing k largest/smallest elements in a collection

Min Heap

  • heapq libraries

Max Heap

  • negative values of integers/floats w/in heapq