COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Using a binary search why will the number 9 never be found in the following list:11, 8, 13, 9, 7, 3
|
It does not work on numbers
|
|
It only works on letters
|
|
The list is not in order
|
|
None of the above
|
Explanation:
Detailed explanation-1: -In case the list of elements is not sorted, there’s no way to use binary search because the median value of the list can be anywhere and when the list is split into two parts, the element that you were searching for could be cut off.
Detailed explanation-2: -In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array.
Detailed explanation-3: -So with an array of length 8, binary search needs at most four guesses.
There is 1 question to complete.