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

3 Answers

+2 votes
A     O(logn)
answered by Veteran (40.1k 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 (51.8k points)  
0 votes
why not ans is B if it is left skew or right skew?
answered by Loyal (2.9k points)  
it is not BST
Top Users Feb 2017
  1. Arjun

    5386 Points

  2. Bikram

    4230 Points

  3. Habibkhan

    3952 Points

  4. Aboveallplayer

    3086 Points

  5. Debashish Deka

    2564 Points

  6. sriv_shubham

    2318 Points

  7. Smriti012

    2240 Points

  8. Arnabi

    2008 Points

  9. mcjoshi

    1696 Points

  10. sh!va

    1684 Points

Monthly Topper: Rs. 500 gift card

20,863 questions
26,022 answers
59,696 comments
22,133 users