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

3 Answers

+2 votes
A     O(logn)
answered by Veteran (41.4k 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 (52.4k 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 Mar 2017
  1. rude

    5236 Points

  2. sh!va

    3054 Points

  3. Rahul Jain25

    2920 Points

  4. Kapil

    2732 Points

  5. Debashish Deka

    2602 Points

  6. 2018

    1574 Points

  7. Vignesh Sekar

    1430 Points

  8. Bikram

    1424 Points

  9. Akriti sood

    1416 Points

  10. Sanjay Sharma

    1128 Points

Monthly Topper: Rs. 500 gift card

21,549 questions
26,889 answers
61,246 comments
23,251 users