Data Structures -> Heaps And Ordered Sets
Use heaps, sets, and multisets to maintain online minima/maxima, medians, and active sets.
- Topic slug:
data-structures/heaps-and-ordered-sets
- Tutorial page: Open tutorial
- Ladder page: Open ladder
- Repo problems currently tagged here:
1
- Repo companion pages:
2
- Curated external problems:
7
Microtopics
- max-heap
- min-heap
- multiset
- lower_bound
- erase-one
- ordered-iteration
- median-maintenance
Learning Sources
Practice Sources
Repo Companion Material
Curated External Problems
Core
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Restaurant Customers |
CSES |
Easy |
- |
Modeling-Heavy |
Sorting; Event Sweeps; Prefix Counts |
Events; Sweep Line; Maximum-Overlap |
A simple and popular event-processing problem that pairs naturally with ordered scans. |
| Room Allocation |
CSES |
Medium |
- |
Greedy-Heavy; Data-Structure-Heavy |
Priority Queues; Sorting; Interval Scheduling |
Priority-Queue; Interval-Scheduling; Assignment |
A classic heap-based assignment problem with a very practical greedy pattern. |
| Movie Festival II |
CSES |
Hard |
- |
- |
- |
Multiset; K-Members |
A canonical multi-assign scheduling problem. |
Classics
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Concert Tickets |
CSES |
Medium |
- |
Data-Structure-Heavy; Greedy-Heavy |
Ordered Sets; Greedy Matching; Lower Bound |
Multiset; Predecessor-Query; Lower Bound |
A classic ordered-set exercise for predecessor queries under deletions. |
| Traffic Lights |
CSES |
Medium |
- |
Data-Structure-Heavy |
Ordered Sets; Interval Maintenance; Multisets |
Ordered-Set; Intervals; Max-Gap; Neighbors |
A well-known benchmark for maintaining gaps between ordered points. |
Advanced
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Sliding Window Cost |
CSES |
Hard |
- |
Data-Structure-Heavy |
Median Maintenance; Multisets; Sliding Windows |
Median; Absolute-Deviation |
A more demanding ordered-structure problem that extends median maintenance into cost tracking. |
| Sliding Window Median |
CSES |
Hard |
- |
Data-Structure-Heavy |
Priority Queues; Multisets; Window Maintenance |
Median; Sliding-Window |
A strong benchmark for maintaining order statistics with heap-like containers. |
Repo Problems
| Code |
Title |
Fit |
Difficulty |
Pattern |
Note |
Solution |
CONCERTTICKETS |
Concert Tickets |
primary |
medium |
multiset predecessor; erase one occurrence; greedy ticket assignment |
Note |
Code |
Regeneration
python3 scripts/generate_problem_catalog.py