AppliedAIPrep logoAppliedAI/Prep
💻 Coding & Engineering Craft
Core

Heaps and Priority Queues

A binary heap keeps a partial order so you can pull the smallest or largest element in O(log n) and peek at it in O(1), without paying to fully sort. This is the right tool for top-k, merging k sorted streams, and a running median, where you need the extreme few, not the whole order. Applied-AI interviews probe it because retrieval, ranking, and streaming pipelines all hinge on cheap partial-order operations.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN CODING & ENGINEERING CRAFTGraphs: BFS, DFS, and Shortest Paths