Vidyalelo
Data Structure · all questions

Searching Algorithms
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

132

Questions

7/7

Page

Pick an option on a question to see the right answer and solution.

What is the auxiliary space requirement of an exponential sort when used with iterative binary search?

Select an option to see the answer and solution.

Jump search has a better time complexity than the exponential search.

Select an option to see the answer and solution.

In which of the following case jump search will be preferred over exponential search?

Select an option to see the answer and solution.

What will be the output of the following code?
#include<bits/stdc++.h> 
using namespace std; 
 
void func(char* str2, char* str1) 
{ 
	int m = strlen(str2); 
	int n = strlen(str1); 
	for (int i = 0; i <= n - m; i++) 
        { 
		int j; 
 
 
		for (j = 0; j < m; j++) 
			if (str1[i + j] != str2[j]) 
				break; 
 
		if (j == m) 
			cout << i << endl; 
	} 
} 
 
int main() 
{ 
	char str1[] = "1253234"; 
	char str2[] = "323"; 
	func(str2, str1); 
	return 0; 
}

Select an option to see the answer and solution.

Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.

Select an option to see the answer and solution.

Which of the following searching algorithm is used with exponential sort after finding the appropriate range?

Select an option to see the answer and solution.

Which of the following is not an alternate name of exponential search?

Select an option to see the answer and solution.

The array is as follows: 1, 2, 3, 6, 8, 10. At what time the element 6 is found? (By using linear search(recursive) algorithm)

Select an option to see the answer and solution.

Choose the recursive formula for the Fibonacci series.(n>=1)

Select an option to see the answer and solution.

Given an array arr = {45, 77, 89, 90, 94, 99, 100} and key = 99; what are the mid values(corresponding array elements) in the first and second levels of recursion?

Select an option to see the answer and solution.

Which of the following searching algorithm is fastest when the input array is not sorted but has uniformly distributed values?

Select an option to see the answer and solution.

Jump search is worse than linear search in terms of time complexity.

Select an option to see the answer and solution.