AI engineering glossary · Data structures algorithms
What is space-time trade-off?
Space-time trade-off (also called time-memory trade-off): The common choice of using more memory to save computation time, or spending more time to save memory. Caching results and precomputed tables are typical examples. Engineers choose a point on this trade-off according to which resource is scarcer.
Space-time trade-off: an example
Storing a prefix-sum array costs O(n) memory but makes each range-sum query O(1) instead of O(n).
Related terms
More Data structures algorithms terms
- Stable sort
- String matching
- Tabulation
- Time complexity
- Timsort
- Top-K problem
- Topological sort
- Traveling salesman problem
Where you learn it
Space-time trade-off is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.