GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
283 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 (73.2k points)   | 283 views

3 Answers

+2 votes
A     O(logn)
answered by Veteran (37.5k points)  
+2 votes
Binary search is always for sorted array , and it takes A) O(log n) time for searching an element
answered by Veteran (49.4k points)  
0 votes
why not ans is B if it is left skew or right skew?
answered by Loyal (2.8k points)  
it is not BST
Top Users Jan 2017
  1. Debashish Deka

    7172 Points

  2. Habibkhan

    4696 Points

  3. Vijay Thakur

    4308 Points

  4. sudsho

    4090 Points

  5. saurabh rai

    4024 Points

  6. Arjun

    3292 Points

  7. santhoshdevulapally

    3066 Points

  8. GateSet

    3016 Points

  9. Bikram

    3014 Points

  10. Sushant Gokhale

    2892 Points

Monthly Topper: Rs. 500 gift card

18,838 questions
23,808 answers
51,589 comments
20,148 users