GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
716 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 (87.2k points)   | 716 views

4 Answers

+5 votes
Best answer
A     O(logn)
answered by Veteran (45k 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 (58.3k points)  
+1 vote
why not ans is B if it is left skew or right skew?
answered by Loyal (3.2k 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 Veteran (14.5k points)  


Top Users Sep 2017
  1. Habibkhan

    6362 Points

  2. Warrior

    2234 Points

  3. Arjun

    2212 Points

  4. nikunj

    1980 Points

  5. manu00x

    1726 Points

  6. SiddharthMahapatra

    1718 Points

  7. Bikram

    1716 Points

  8. makhdoom ghaya

    1660 Points

  9. A_i_$_h

    1528 Points

  10. rishu_darkshadow

    1512 Points


25,988 questions
33,561 answers
79,406 comments
31,026 users