GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
672 views

The time taken by binary search algorithm to search a key in a sorted array of n elements is

  1. $O\: (\log_2 \: n)$
  2. $O \:  (n)$
  3. $O \: (n \: \log_2 \: n)$
  4. $O \:  (n^2)$
asked in Algorithms by Veteran (78.1k points)   | 672 views

4 Answers

+5 votes
Best answer
A     O(logn)
answered by Veteran (44.1k points)  
selected by
+3 votes
Binary search is always for sorted array , and it takes A) O(log n) time for searching an element
answered by Veteran (55.5k points)  
+1 vote
why not ans is B if it is left skew or right skew?
answered by Loyal (3.1k points)  
it is not BST
+1 vote
Binary Search Algorithm takes O(log n) time in order to search an element in the array of sorted list...
answered by Boss (9.6k points)  


Top Users Jul 2017
  1. Bikram

    3782 Points

  2. manu00x

    2464 Points

  3. Debashish Deka

    1832 Points

  4. joshi_nitish

    1494 Points

  5. Arnab Bhadra

    1096 Points

  6. Arjun

    1054 Points

  7. Hemant Parihar

    1050 Points

  8. Shubhanshu

    972 Points

  9. Ahwan

    876 Points

  10. akash.dinkar12

    642 Points


23,953 questions
30,895 answers
70,108 comments
29,273 users