Exam-style question
Try this first
Algorithm A takes a number of steps represented by 3n + 2, while Algorithm B takes a number of steps represented by n², where n is the problem size. Which conclusion is most appropriate for large problem sizes?.
- A.Algorithm B is generally more time-efficient because n² grows more slowly than 3n + 2
- B.Algorithm A is generally more time-efficient because 3n + 2 grows more slowly than n²
- C.Both algorithms must always take exactly the same time
- D.The problem size has no effect on the comparison
Model answer
What a good answer should say
- Algorithm A is generally more time-efficient because 3n + 2 grows more slowly than n²
Explanation
Why this works
The expressions describe how the number of steps changes as the problem size increases. For large values of n, n² grows faster than 3n + 2, so Algorithm A is generally more time-efficient.
Common mistake
No common mistake is linked to this question yet.
