Reading the Constraints
Assessment problems are set by people who choose deliberately. The bound is not flavour text, it is the author telling you which complexity class they intend, and once you can read it the space of plausible approaches collapses from everything you know to two or three things.
The ladder
These are the bounds problem authors set, and they are calibrated for a compiled language at a few seconds:
| Bound on | Target | Usually means |
|---|---|---|
| Permutations, brute force over orderings | ||
| Subsets, meet in the middle | ||
| Floyd-Warshall, interval dynamic programming | ||
| Pairwise dynamic programming, nested scan | ||
| Sorting, heap, binary search, balanced tree | ||
| One pass, hash map, two pointers, prefix sums | ||
| Binary search, arithmetic, fast exponentiation |
The rest of this lesson is for subscribers
Unlock every lesson in Programming for Quantitative Developers, and every other premium course.
Subscribe to continueTest your knowledge
Questions are only available to subscribers.
Keep reading Programming for Quantitative Developers
25 lessons in this course, and every other premium course, on one subscription.
- Every lesson in every course, with the worked examples and interactive simulators
- Graded questions on every lesson, with explanations for the wrong answers as well as the right one
- The trainers, timed assessments and brainteaser library that go with them