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

4 Answers

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


Top Users May 2017
  1. akash.dinkar12

    3338 Points

  2. pawan kumarln

    2108 Points

  3. Bikram

    1922 Points

  4. sh!va

    1682 Points

  5. Arjun

    1614 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1208 Points

  8. Angkit

    1056 Points

  9. LeenSharma

    1018 Points

  10. Arnab Bhadra

    812 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    1008 Points

  2. pawan kumarln

    734 Points

  3. Arnab Bhadra

    726 Points

  4. Arjun

    342 Points

  5. bharti

    328 Points


22,893 questions
29,196 answers
65,302 comments
27,695 users