Exam-style question
Try this first
A developer is choosing between two algorithms for an automated system. Algorithm X usually completes quickly but requires a large amount of memory as the problem grows. Algorithm Y takes longer but uses much less memory. Discuss how the developer should compare these algorithms and decide which is appropriate.
Answer and explanation
Concise answer
The developer should compare the algorithms as functions of the problem size rather than relying on a single test.
Why this is correct
There is not always one algorithm that is best in every respect. Comparing both time and space efficiency against the expected problem size supports an informed design decision and helps the system run quickly while using suitable resources.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
