Lookup tables
- Stage
- 3
- Module
- M3.5
- Lessons
- 1
In this module
- Use a list or dictionary to map inputs to outputs.
- Build a lookup table from problem data and query it quickly.
- Avoid repeated computation by storing results in a lookup table.
Before this module
Lessons
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2016 J4Arrival Time (opens on DMOJ in a new tab) DMOJ
Look up an arrival time using a rule that changes across the day.
Why DMOJ: A lookup-driven simulation, matching this lesson's table-first approach.
- 2024 S1Hat Circle (opens on WMOJ in a new tab) WMOJ
Compare values at paired positions around a circular arrangement.
- 2023 J2Chili Peppers (opens on WMOJ in a new tab) WMOJ
Look up a value for each item using a fixed table of entries.