Recent questions tagged binary-search

0 0 votes
1 1 answer
152
152 views
Which of the following cannot be a sequence of keys compared during a binary search for some target key?$500,200,450,180$ $500,450,200,180$ $180,500,200,450$ $180,200,500...
2 2 votes
2 2 answers
183
183 views
Suppose Binary Search is used in Insertion Sort to locate where the $i$th element should be inserted among the first $i-1$ elements.What is the worst-case running time of...
2 2 votes
1 1 answer
210
210 views
A sorted table contains $2000$ distinct elements in increasing order. A key is searched using binary search, and it is guaranteed that the key exists in the table.What is...
4 4 votes
2 2 answers
871
871 views
Let A be a sorted array containing $1000$ distinct integers. You perform a recursive binary search on $\text{A}$ to find an element $\text{y}$. Suppose each comparison ch...
8 8 votes
5 5 answers
5.3k
5.3k views
For which of the following inputs does binary search take time $O(\log n)$ in the worst case?An array of $n$ integers in any orderA linked list of $n$ integers in any ord...
23 23 votes
4 4 answers
9.0k
9.0k views
​​​​​Let $F(n)$ denote the maximum number of comparisons made while searching for an entry in a sorted array of size $n$ using binary search.Which ONE of the following op...
6 6 votes
2 2 answers
1.8k
1.8k views
Bob writes down a number between 1 and 1,000. Mary must identify that number by asking "yes/no" questions of Bob. Mary knows that Bob always tells the truth. If Mary uses...
0 0 votes
2 2 answers
1.9k
1.9k 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). Ho...
2 2 votes
2 2 answers
652
652 views
Let $A$ be a sorted array containing $n$ distinct integers, such that, for all $1 \leq i<j \leq n$, we have $A[i]<A[j]$. Note that the integers stored in the array $A$ ar...
0 0 votes
2 2 answers
834
834 views
You are given two sorted arrays $X[\;]$ and $Y[\;]$ of positive integers. The array sizes are not given. Accessing any index beyond the last element of the arrays returns...
10 10 votes
3 answers 3 answers
2.2k
2.2k views
Given an unsorted array of $n$ distinct elements, you want to find this set of $\log n$ elements: those at positions $1,2,4,8,16, \ldots, n/2$ if array were sorted. In ot...
1 1 vote
1 1 answer
623
623 views
The recurrence relation for binary search algorithm is :$\text{T(n) = 2T (n/2) + O (1)}$$\text{T(n) = 2T (n/2) + O (n)}$$\text{T(n) = T (n/2) + O (1)}$$\text{T(n) = T (n/...
40 40 votes
10 answers 10 answers
28.4k
28.4k views
What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size $n$?$\Theta ( \sqrt{n})$$\Theta (\log _2(n))$$\Theta...
1 1 vote
2 2 answers
896
896 views
The program written for binary search, calculates the midpoint of the span as $\text{mid : =(Low+High)/2}$. The program works well if the number of elements in the list i...
3 3 votes
1 1 answer
2.5k
2.5k views
Consider the process of inserting an element into a $Max\ Heap$, where the $Max\ Heap$ is represented by an $array$. Suppose we perform a binary search on the path from ...
1 1 vote
1 1 answer
4.5k
4.5k views
Given a sorted array of distinct integers A[1,2,3,..,n], the tightest upper bound to check the existence of any index i for which A[i]= i is equal to O($n^{a}log^{b}n)$. ...
11 11 votes
6 6 answers
7.4k
7.4k views
Asha and Lata play a game in which Lata first thinks of a natural number between $1$ and $1000$. Asha must find out that number by asking Lata questions, but Lata can onl...
1 1 vote
4 4 answers
3.1k
3.1k views
There are two sorted list each of length n. An element to be searched in the both the lists. The lists are mutually exclusive. The maximum number of comparisons required ...
2 2 votes
1 1 answer
2.0k
2.0k views
In which of the cases shown below, Binary search can not always be applied for searching(A) Hierarchical data record (B) Internet Domain name conversion (C) Searching a t...
3 3 votes
0 0 answers
1.6k
1.6k views
Consider a sorted array A of n integer elements, A[0]...A[n − 1].A search operation is to be performed on this array using .Binary search algorithm. If the element being ...
0 0 votes
1 1 answer
2.9k
2.9k views
The average number of comparisons made by binary search for an unsuccessful search in array A
0 0 votes
2 2 answers
1.9k
1.9k views
0 0 votes
1 1 answer
703
703 views
https://gateoverflow.in/18752/tifr2010-b-29IN THIS QUESTION WHY WE CANT NOT APPLY SINGLE BINARY SEARCH ON ENTIRE ARRAY ???BECAUSE LET WE HAVE ARRAY 1 14 3 12 5 10 7 8 9 ...
2 2 votes
4 4 answers
4.9k
4.9k views
for binary search in an array of n elements the average number of searches is $\left \lfloor \log_{2}n \right \rfloor$ or $\left \lceil \log_{2}n \right \rceil$ ?
0 0 votes
2 2 answers
1.5k
1.5k 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)