Computer Science, asked by Anonymous, 1 year ago

what is Binary search❓

Answers

Answered by DharamveerSingh
2
A simple approach is to do linear search.The time complexity of above algorithm is O(n). Another approach to perform the same task is using Binary Search.

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. Repeatedly check until the value is found or the interval is empty.


DharamveerSingh: Thnks,,,
angela86: welcome
angela86: your answer is very nice
safrin34: not nice
DharamveerSingh: Thnks,,,, if you like it,,,,
safrin34: no
DharamveerSingh: OK,,, I will try better for you,,,, next time
safrin34: ok
Similar questions