Recent questions tagged searching

2 2 votes
2 2 answers
192
192 views
Which of the following is correct order of increasing time complexity of algorithmsTower of Hanoi with $n$ disk.Binary search given $n$ sorted numbers.Heap sort given $n$...
2 2 votes
3 3 answers
408
408 views
Which of the following is $\text{TRUE}?$The cost of searching an AVL tree is $\theta(\log n)$ but that of binary search is $0(n)$The cost of searching an AVL tree in $\th...
1 1 vote
0 0 answers
229
229 views
Match List - I with List - II. LIST-I LIST-IIA.Hill climbingI.$O(b^d)$B.Best first searchII.$O(bd)$C.A* SearchIII.$O(1)$D.Depth first searchIV.$O(b^m)$ Choose the correct...
37 37 votes
4 4 answers
15.0k
15.0k views
​​​​Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph $G$ is/are TRUE?A DFS tree of $G$ is...
35 35 votes
8 8 answers
17.6k
17.6k views
​​An array $A$ of length $n$ with distinct elements is said to be bitonic if there is an index $1 \leq i \leq n$ such that $A[1 . . i]$ is sorted in the non-decreasing or...
1 1 vote
1 1 answer
617
617 views
Arun has a non-empty subset $\text{S}$ of the numbers $\{1,2,3, \ldots, 1000\}$. Bela wants to find any number $\text{x}$ in Arun's set $\text{S}$.To do this, Arun and Be...
0 0 votes
1 1 answer
620
620 views
The $\text{A}^{*}$ algorithm is optimal when,It always finds the solution with the lowest total cost if the heuristic ' $h$ ' is admissible.Always finds the solution with...
0 0 votes
0 0 answers
495
495 views
Which of the following type of search is easiest to implement?Linear searchNon-linear searchMultidimensional searchBidirectional search
10 10 votes
3 answers 3 answers
2.3k
2.3k 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...
0 0 votes
1 1 answer
849
849 views
If a hash table is implemented as a search tree, the expected time required to enter $\text{n}$ names and make $\text{m}$ searches is proportional to :$\text{(n+m)} \log_...
1 1 vote
1 1 answer
821
821 views
Finding the location of the element with a given value is :TraversalSearchSortNone of the options
1 1 vote
3 3 answers
1.8k
1.8k views
Let $A$ be an array of $31$ numbers consisting of a sequence of $0$’s followed by a sequence of $1$’s. The problem is to find the smallest index $i$ such that $A[i]$ is $...
0 0 votes
1 1 answer
1.2k
1.2k views
Observe that the while loop of the INSERTION-SORT procedure uses a linear search to scan (backward) through the sorted subarray $A[i\dots j-1]$ Can we use a binary search...
0 0 votes
0 0 answers
518
518 views
Referring back to the searching problem (see Exercise 2.1-3), observe that if the sequence $A$ is sorted, we can check the midpoint of the sequence against $v$ and elimin...
0 0 votes
1 1 answer
4.2k
4.2k views
Consider the linear search again (see Exercise 2.1-3). How many elements of the input sequence need to be checked on the average, assuming that the element being searched...
0 0 votes
0 0 answers
637
637 views
Consider the searching problem:Input: A sequence of $n$ numbers $A = \langle a_1, a_2,\dots a_n \rangle$ and a value $v$ Output: An index $i$ such that $v=A[i]$ or the s...
2 2 votes
1 1 answer
3.0k
3.0k views
.Given an array of distinct integers A[1, 2,…n]. Find the tightest upper bound to check the existence of any index i for which A[i]=i.Ans should be O(log n) right by doin...
1 1 vote
1 1 answer
937
937 views
In a sorted file structure, let the cost of reading a page be $D=10$ milliseconds, the number of data pages be $B=1024$. Let the average time to process a record is $C=5$...
0 0 votes
1 1 answer
975
975 views
Match List I with List II and choose the correct answer from the code given below.List IList II(a)Greedy Best-First Search(i)Selects a node for expansion if optimal path ...
1 1 vote
1 answers 1 answer
1.1k
1.1k views
A sequential search operation is performed on an array $A$ for the key value of $'x'$ (ignore quotes). Consider the following piece of assembly language code that uses ba...
0 0 votes
0 0 answers
795
795 views
2 2 votes
0 0 answers
649
649 views
Which is faster and by how much, a linear search of only 1000 elements on a 5-GHz computer or a binary search of 1 million elements on a 1-GHz computer. Assume that the e...
1 1 vote
2 2 answers
2.2k
2.2k views
Consider the following algorithm for searching for a given number $x$ in an unsorted array $A[1 \ldots n]$ having $n$ values :1. Sequentially choose $i$ from 1 to $n$2. i...
1 1 vote
1 1 answer
1.3k
1.3k views
Suppose A is a sorted array and some of the elements are duplicates. What is the best upper bound to find out the number of elements that are equal to a given key 'k'a)...
0 0 votes
0 0 answers
551
551 views
This question is not related to GATE, but certainly would help you to grill your mind to come up with a better approach.. Feel free to comment if you think, this is not a...