Write a brief advantages of binary search over linear search
Answers
Answered by
0
Hello Buddy!!
AnSWeR ➡ In linear serach when you perform one operation you reduce the size of the problem by one . But when you do one operation in binary search you reduce the size of the problem by half . It sounds efficient , isn't it
That's why time complexity of linear/sequential search is O(n) while binary search is O(logn).
Note - binary serach is applied only on sorted arrays.
I answered this question assuming that you have already read theory and algorithm of Binary as well as sequential serach .
#ThAnKYou___♥
AnSWeR ➡ In linear serach when you perform one operation you reduce the size of the problem by one . But when you do one operation in binary search you reduce the size of the problem by half . It sounds efficient , isn't it
That's why time complexity of linear/sequential search is O(n) while binary search is O(logn).
Note - binary serach is applied only on sorted arrays.
I answered this question assuming that you have already read theory and algorithm of Binary as well as sequential serach .
#ThAnKYou___♥
Similar questions