Exam-style question
Try this first
What does a linear search do when searching a list for a target value?.
- A.It checks items one at a time from the beginning until the target is found or the list ends.
- B.It repeatedly checks the middle item and discards half of the list.
- C.It sorts the list before checking every item.
- D.It compares only the first and last items.
Model answer
What a good answer should say
- It checks items one at a time from the beginning until the target is found or the list ends.
Explanation
Why this works
A linear search examines list elements sequentially, starting at the first element. It stops when the target is found or when every element has been checked.
Common mistake
No common mistake is linked to this question yet.
