Which of the following don't affect the time complexity of bucket sort?
A. algorithm implemented for sorting individual buckets
B. number of buckets used
C. distribution of input
D. input values
Select an option to see the answer and solution.
Tim sort begins sorting the given array by using which of the following sorting algorithm?
A. selection sort
B. quick sort
C. insertion sort
D. merge sort
Select an option to see the answer and solution.
What is the average case time complexity of recursive bubble 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 is the auxiliary space complexity of standard merge sort?
A. O(1)
B. O(log n)
C. O(n)
D. O(n log n)
Select an option to see the answer and solution.
What is the median of three techniques in quick sort?
A. quick sort with random partitions
B. quick sort with random choice of pivot
C. choosing median element as pivot
D. choosing median of first, last and middle element as pivot
Select an option to see the answer and solution.
Which of the following is not true about radix sort?
A. Radix sort performs better than quick sort when we have log n bits for every digit
B. Radix sort has better cache performance than quick sort
C. Radix sort has higher values of constant factor in asymptotic notation
D. Radix sort takes more space than quick sort
Select an option to see the answer and solution.
The Pancake Problems (1975, 1979, 1973) did NOT involve which of the following people?
A. Bill Gates
B. Jacob Goodman
C. Christos Papadimitriou
D. John Goodman
Select an option to see the answer and solution.
Consider the code given below, which runs insertion sort:
void insertionSort(int arr[], int array_size)
{
int i, j, value;
for (i = 1; i < array_size; i++)
{
value = arr[i];
j = i;
while (________ )
{
arr[j] = arr[j − 1];
j = j − 1;
}
arr[j] = value;
}
}
Which condition will correctly implement the while loop?
A. (j > 0) || (arr[j - 1] > value)
B. (j > 0) && (arr[j - 1] > value)
C. (j > 0) && (arr[j + 1] < value)
D. (j > 0) && (arr[j + 1] < value)
Select an option to see the answer and solution.
Insertion sort is an online sorting algorithm.
Select an option to see the answer and solution.
LSD radix sort is faster than comparison sorts.
Select an option to see the answer and solution.
The essential part of Heap sort is construction of max-heap. Consider the tree shown below, the node 24 violates the max-heap property. Once heapify procedure is applied to it, which position will it be in?
Select an option to see the answer and solution.
Brick sort uses which of the following methods for sorting the input?
A. selection
B. partitioning
C. merging
D. exchanging
Select an option to see the answer and solution.
What is the average time complexity of bead sort (S = sum of input elements)?
A. O(n)
B. O(S)
C. O(n2 )
D. O(n log n)
Select an option to see the answer and solution.
Which of the following is an advantage of binary insertion sort over its standard version?
A. it has better time complexity
B. it has better space complexity
C. it makes less number of comparisons
D. it has no significant advantage
Select an option to see the answer and solution.
Sleep sort does gives a correct output when . . . . . . . .
A. any input element is negative
B. input array is reverse sorted
C. any input element is positive
D. when there is a very small number to the left of very large number
Select an option to see the answer and solution.
Which of the following sorting algorithm is not stable . . . . . . . .
A. insertion sort
B. bubble sort
C. merge sort
D. bogosort
Select an option to see the answer and solution.
Which of the following sorting algorithm is not in-place?
A. insertion sort
B. tim sort
C. quick sort
D. intro sort
Select an option to see the answer and solution.
Binary insertion sort is a comparison based sort.
Select an option to see the answer and solution.
What is the running time of an insertion sort algorithm if the input is pre-sorted?
A. O(N2 )
B. O(N log N)
C. O(N)
D. O(M log N)
Select an option to see the answer and solution.
What is the space complexity of stooge sort?
A. O(n)
B. O(1)
C. O(log n)
D. O(n log n)
Select an option to see the answer and solution.