Deprecated: Implicit conversion from float-string "1540464071.836" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1540464071.836" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1540464071.836" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1540464071.836" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1540464071.836" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594
Algorithms: Binary Search
retagged by
1,061 views
1 votes
1 votes
What is the worst case complexity for searching for a key in a sorted array using Binary Search??
retagged by

2 Answers

Best answer
3 votes
3 votes

In a sorted array, we can apply binary search algorithm which takes O($logn$) time in worst case to search a key.

Reference:Binary search

selected by

Related questions


Deprecated: Implicit conversion from float-string "1685995111.336" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1685995111.336" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1685995111.336" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1685995111.336" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1533749349.256" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1533749349.256" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1533749349.256" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1533749349.256" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803
1.1k
views
2 answers
0 votes
dhruba asked Jun 5, 2023
1,102 views
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m < n). ...
1.1k
views
1 answers
0 votes
Sabir Khan asked Aug 8, 2018
1,067 views
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is(A) (n)(B) (logn)(C) (log*n)(D) (1)
2.0k
views
1 answers
3 votes
iarnav asked Mar 13, 2018
2,040 views
The average successful search time taken by binary search on a sorted array of 5 CONSECUTIVE integers starting with 1?My Answer is - 2.2Kindly tell me is it correct or no...
2.4k
views
2 answers
3 votes
rahul sharma 5 asked Mar 8, 2018
2,395 views
Why to prefer binary search over ternary search?Can someone give recreance relation for ternary search,so that i can compare both