Vidyalelo
Data Structure · all questions

Sorting Algorithms
practice.

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

509

Questions

15/26

Page

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

Bucket sort is a generalization of which of the following sort?

Select an option to see the answer and solution.

What is the worst case time complexity of cocktail sort?

Select an option to see the answer and solution.

What will be the recurrence relation of the code of recursive bubble sort?

Select an option to see the answer and solution.

Which of the following sorting algorithm is not in place?

Select an option to see the answer and solution.

Which of the following sorting algorithm is not a constituent of introsort?

Select an option to see the answer and solution.

How many write operations will be required to sort the array arr={2, 4, 3, 5, 1} using cycle sort?

Select an option to see the answer and solution.

What is the auxiliary space requirement of counting sort?

Select an option to see the answer and solution.

The initial gap between two elements being compared . . . . . . . .

Select an option to see the answer and solution.

What will be the pivot for the array arr={8, 2, 4, 9} for making the first partition when a median of three quick sort is implemented?

Select an option to see the answer and solution.

How many elements can be sorted in O(logn) time using Heap sort?

Select an option to see the answer and solution.

In insertion sort, the average number of comparisons required to place the 7th element into its correct position is . . . . . . . .

Select an option to see the answer and solution.

Which of the following is not true about library sort?

Select an option to see the answer and solution.

Cycle sort is an adaptive sorting algorithm.

Select an option to see the answer and solution.

In binary tree sort, we first construct the BST and then we perform . . . . . . . . traversal to get the sorted order.

Select an option to see the answer and solution.

Which one of the following sorting algorithm requires recursion?

Select an option to see the answer and solution.

How many comparisons will be required to sort the array arr={5, 4, 7, 1, 9} using bead sort?

Select an option to see the answer and solution.

What is the other name for a shell sort algorithm?

Select an option to see the answer and solution.

What will be the output of the given C++ code?
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
	int arr[] = {1, 3,4,2,5}; 
	int n = sizeof(arr)/sizeof(arr[0]);
	sort(arr+2, arr+n, greater<int>()); 
        int a;
	for (int a = 0; a < n; a++) 
		cout << arr[a] << " "; 
	return 0; 
}

Select an option to see the answer and solution.

Which of the following sorting algorithm is stable?

Select an option to see the answer and solution.

Which of the following statement is not a stable sorting algorithm?

Select an option to see the answer and solution.