Computer Science, asked by purnikumari096, 5 months ago

write a program to create a list by taking input from user and use binary search technique to search a number​

Answers

Answered by Anonymous
0

Explanation:

Binary Search: Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half.

Answered by yashsingh8704
0

Answer:

We basically ignore half of the elements just after one comparison.

   Compare x with the middle element.

   If x matches with middle element, we return the mid index.

   Else If x is greater than the mid element, then x can only lie in right half subarray after the mid element. So we recur for right half.

   Else (x is smaller) recur for the left half.

Explanation:

Similar questions