AlgoViz

O(2ⁿ) exponential space

easy 15 min

O(2ⁿ) space means the memory doubles every time one more item is added.

Where it shows up

The same pattern appears across everyday software.

  • Delivery and route planning

    For a handful of stops, an exact route can come from the Held–Karp DP, whose table has n · 2ⁿ entries. That is why exact solvers stop at around 20 stops and larger fleets switch to heuristics that keep far less state.

  • Combinatorial test design

    Testing every on/off mix of 30 feature flags means storing or running over a billion configurations. Test teams use pairwise testing so the stored plan stays small.

  • Logic and chip design

    A truth table for a circuit with n inputs has 2ⁿ rows, so tools represent functions with compact structures such as binary decision diagrams instead of full tables.

  • Puzzle and game solvers

    Solvers that cache every visited state (a transposition table) can fill memory long before they run out of time, so they use fixed-size caches that overwrite old entries.

  • Budget and portfolio selection

    Choosing which projects to fund under a budget is a knapsack problem. Storing a result for every subset is exponential; storing one per budget value is pseudo-polynomial, which is what production planners do.