The Gateway to Computer Science Excellence
+7 votes

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)$
in Algorithms by Veteran (105k points) | 3.9k views

3 Answers

+5 votes
Best answer
A     O(logn)
by Boss (48.8k points)
selected by
+3 votes
Binary search is always for sorted array , and it takes A) O(log n) time for searching an element
by Veteran (117k points)
+1 vote
Binary Search Algorithm takes O(log n) time in order to search an element in the array of sorted list...
by Boss (41.9k 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
50,645 questions
56,601 answers
102,227 users