An algorithm that works on the happy path may still fail at the boundaries. Before declaring it finished, test:
- Empty input
- A single element
- Duplicate values
- A missing target
- The largest allowed input
Then add cases that fit the domain: negative values, reverse-sorted data, disconnected graphs, cycles, or repeated updates.
Edge cases are not afterthoughts. They reveal whether the algorithm’s assumptions are actually true.
Use the complete checklist in the free Algorithms Made Simple Quick Reference.
