COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Which of these, given a list with 100 elements would look at index 50 first, and the decide to look at index 25 or index 75 next?
|
linear search
|
|
perimeter search
|
|
straight search
|
|
binary search
|
|
split seach
|
Explanation:
Detailed explanation-1: -Binary search works on sorted arrays. Binary search begins by comparing an element in the middle of the array with the target value.
Detailed explanation-2: -In a binary search algorithm, the array taken gets divided by half at every iteration. Again dividing by half in the third iteration will make the array’s length = (n/2)/2=n/(2^k).
Detailed explanation-3: -The divide and conquer strategy is used in binary search, where the item is compared to the middle element of the list after the list is divided into two halves.
There is 1 question to complete.