MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When the item being search in binary search does not match to the calculated middle position because the search item is at the upper list, what will you do?
A
reassign a new value to the lowest position whereas:low = mid + 1
B
reassign a new value to the highest position whereas:high = mid-1
C
reassign a new value to the lowest position whereas:mid = mid + 1
D
none of the above
Explanation: 

Detailed explanation-1: -Approach for Binary Search If the target element is greater than the middle element, then the search continues in the right half. Else if the target element is less than the middle value, the search continues in the left half.

Detailed explanation-2: -Now, the question arises, is Binary Search applicable on unsorted arrays? So, the answer is NO, it is not possible to use or implement Binary Search on unsorted arrays or lists, because, the repeated targeting of the mid element of one half depends on the sorted order of data structure.

Detailed explanation-3: -Hence the correct answer is mid : = (High-Low)/2 + Low .

Detailed explanation-4: -Binary search compares the target value to the middle element of the array.

There is 1 question to complete.