228k views
1 vote
A group of students writes their names and unique student ID numbers on sheets of paper. The sheets are then randomly placed in a stack.

Their teacher is looking to see if a specific ID number is included in the stack. Which of the following best describes whether their teacher should use a linear or a binary search?

A. The teacher could use either type of search though the linear search is likely to be faster
B. The teacher could use either type of search though the binary search is likely to be faster
C. Neither type of search will work since the data is numeric
D. Only the linear search will work since the data has not been sorted

1 Answer

6 votes

Answer:

D.

Step-by-step explanation:

Binary searches are required to be first sorted, since they use process of elimination through halving the list every round until the answer is found. Linear searches just start from the beginning and check one by one.

User Tao Huang
by
5.9k points