The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+3 votes
794 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 (98k points) | 794 views

4 Answers

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


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,017 questions
36,844 answers
91,378 comments
34,721 users