Bucket sort is a generalization of which of the following sort?
A. LSD radix sort
B. Pigeonhole sort
C. Counting sort
D. MSD radix sort
Select an option to see the answer and solution.
What is the worst case time complexity of cocktail sort?
A. O(n)
B. O(n log n)
C. O(n2 )
D. O(log n)
Select an option to see the answer and solution.
What will be the recurrence relation of the code of recursive bubble sort?
A. T(n) = 2T(n/2) + n
B. T(n) = 2T(n/2) + c
C. T(n) = T(n-1) + n
D. T(n) = T(n-1) + c
Select an option to see the answer and solution.
Which of the following sorting algorithm is not in place?
A. quick sort
B. strand sort
C. cycle sort
D. heap sort
Select an option to see the answer and solution.
Which of the following sorting algorithm is not a constituent of introsort?
A. selection sort
B. quicksort
C. insertion sort
D. heap sort
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?
A. O(1)
B. O(n)
C. O(log n)
D. O(n+k) k=range of input
Select an option to see the answer and solution.
The initial gap between two elements being compared . . . . . . . .
A. is equal to number of elements in the array
B. is equal to 1.3
C. depends on the number of iterations
D. depends on the compiler being used
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?
A. O(1)
B. O(n/2)
C. O(logn/log(logn))
D. O(logn)
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?
A. it uses binary search and insertion sort in its implementation
B. gaps are created between successive elements in order to ensure faster insertion
C. array needs to be re balanced after every insertion
D. it is an in place sorting algorithm
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.
A. inorder
B. postorder
C. preorder
D. level order
Select an option to see the answer and solution.
Which one of the following sorting algorithm requires recursion?
A. pigeonhole sort
B. strand sort
C. insertion sort
D. counting sort
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?
A. Diminishing increment sort
B. Diminishing decrement sort
C. Insertion sort
D. Selection sort
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;
}A. 1 2 3 4 5
B. 1 5 4 3 2
C. 5 4 3 2 1
D. 1 3 5 4 2
Select an option to see the answer and solution.
Which of the following sorting algorithm is stable?
A. Selection sort
B. Quick sort
C. Bubble sort
D. Heap sort
Select an option to see the answer and solution.
Which of the following statement is not a stable sorting algorithm?
A. LSD radix sort
B. MSD radix sort
C. Counting sort
D. Pigeonhole sort
Select an option to see the answer and solution.