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.

Respuesta :

Answer:

D

Explanation:

For the linear search, the input range doesn't need to be sorted. It works on a both unsorted and sorted array.

For binary search, the input range must be sorted, otherwise, it will fail.

The answer choice which best describes whether their teacher should use a linear or a binary search is:

  • D. Only the linear search will work since the data has not been sorted.

According to the given question,l we are asked to show the answer choice which best describes whether their teacher should use a linear or a binary search.

As a result of this, we can see that the linear search would help the teacher to input unsorted data into the system and this is the best method, while the binary search would require the input range to be sorted.

Therefore, the correct answer is option D

Read more here:

https://brainly.com/question/24786985

ACCESS MORE