Exam-style question
Try this first
What does the time complexity O(n) mean for a linear search?.
- A.The number of comparisons is unrelated to the number of items.
- B.The number of comparisons can grow in proportion to the number of items.
- C.The search always makes exactly one comparison.
- D.The search always makes the same number of comparisons as a binary search.
Answer and explanation
Concise answer
The number of comparisons can grow in proportion to the number of items.
Why this is correct
For a list with n items, a linear search may need to examine each item. Therefore, the amount of work grows linearly as n increases, giving a time complexity of O(n).
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.
