Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Skill

Heaps & Priority Queues

Implement a binary heap and use priority queues for top-k, merging and scheduling problems.

Intermediate1 roadmap

3 objectives 5 steps about 100 min

Check what you know

The lessons are coming later. The knowledge check is ready now.

Take the knowledge check

This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.

Learning objectives

  • Implement an array-based binary min-heap with sift-up, sift-down and O(n) heapify, and state each operation's cost.
  • Use heapq to solve top-k, k-way merge and running-median problems, including max-heap and tuple-priority patterns.
  • Choose between a heap, a sorted list and a balanced tree based on which operations dominate (peek-min, arbitrary delete, ordered iteration).

Lesson plan

5 steps, about 100 min · 0 of 4 lessons available so far

  1. A Tree Stored in an Array Concept · 15 min · coming later
  2. Lab: Sift-Up, Sift-Down and Heapify Lab · 30 min · coming later
  3. heapq Patterns: Top-k, k-Way Merge, Two Heaps Worked example · 25 min · coming later
  4. Priority Queues for Scheduling and Events Worked example · 15 min · coming later
  5. Check: Heap Operations and Uses Knowledge check · 6 questions

Practise it

Implement a MinHeap with push, pop, peek and heapify that matches heapq over 10,000 random operations, then use heapq to merge k sorted log files by timestamp and to report a running median of a number stream.

References

Hard prerequisites

Unlocks

On these roadmaps

Progress and evidence for this skill are shared across all of them.