COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
What is the third step using Binary Search to look for the number 31 in this list:1, 3, 4, 8, 10, 11, 16, 28, 31, 32, 45, 49, 51, 69, 75
|
Compare the number 28 to the given number
|
|
Compare the number 8 to the given number
|
|
Compare the number 32 to the given number
|
|
Compare the number 49 to the given number
|
Explanation:
Detailed explanation-1: -Binary search begins by comparing an element in the middle of the array with the target value. If the target value matches the element, its position in the array is returned. If the target value is less than the element, the search continues in the lower half of the array.
Detailed explanation-2: -Binary search is a fast search algorithm with run-time complexity of (log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form.
There is 1 question to complete.