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

20/26

Page

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

What is the average time complexity of pigeonhole sort (k=range of input)?

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, arr+n, greater<int>());   
    int a; 
    for (a = 0; a < n; a++) 
        cout << arr[a] << " ";   
    return 0; 
}

Select an option to see the answer and solution.

Bogosort works by . . . . . . . .

Select an option to see the answer and solution.

What is the average case time complexity of library sort?

Select an option to see the answer and solution.

What is the best case efficiency of bubble sort in the improvised version?

Select an option to see the answer and solution.

What is an internal sorting algorithm?

Select an option to see the answer and solution.

Consider the original array 17 8 12 4 26. How many comparisons are needed to construct the BST on the original array?

Select an option to see the answer and solution.

Which of the following statements is the basic for loop for a shell sort algorithm?

Select an option to see the answer and solution.

Binary Insertion sort is an online sorting algorithm.

Select an option to see the answer and solution.

Which of the following sorting algorithms is used along with quick sort to sort the sub arrays?

Select an option to see the answer and solution.

Cocktail sort is a comparison based sort.

Select an option to see the answer and solution.

Cycle sort is a comparison based sort.

Select an option to see the answer and solution.

What is the best case time complexity randomized quick sort?

Select an option to see the answer and solution.

Which of the following data structure is required for the implementation of tree sort?

Select an option to see the answer and solution.

What is the average number of comparisons used in a heap sort algorithm?

Select an option to see the answer and solution.

What is the best case time complexity of bogosort?

Select an option to see the answer and solution.

The given array is arr = {3, 4, 5, 2, 1}. The number of iterations in bubble sort and selection sort respectively are . . . . . . . .

Select an option to see the answer and solution.

In heap sort, after deleting the last minimum element, the array will contain elements in?

Select an option to see the answer and solution.

Median of three quick sort is a stable sort.

Select an option to see the answer and solution.

Which of the following is not an advantage of tree sort?

Select an option to see the answer and solution.