Model answer
Memoisation stores previous results to avoid repeated recursion, and a hash index uses extra buckets to replace repeated scans with expected O(1) lookup. Both spend memory to save time.
Use the key terms, then explain the reasoning.
Algorithms often exchange memory for speed. Good engineering chooses a balance that fits latency, hardware, energy, and environmental constraints.
Time–space trade-offs appear whenever saved results, indexes, caches, or preprocessing reduce repeated computation. The reverse trade uses recomputation or compact encodings to lower memory use.
Energy is consumed by CPU instructions, memory transfers, storage access, and network communication. Algorithmic improvements reduce these activities at their source, while cache-friendly layouts can improve both speed and energy without changing Big-O.
This is primarily a conceptual or selection topic. Use the linked implementation topics in this section to see the invariant expressed in C++.
Open a prompt when you are ready to check your answer.