Sorting


Q31.

Choose the correct alternatives (More than one may be correct).The complexity of comparision based sorting algorithms is:
GateOverflow

Q32.

Give the correct matching for the following pairs: \begin{array}{ll|ll}\hline \text{(A)} & \text{$O (\log n)$} & \text{(P)} & \text{Selection sort} \\\hline \text{(B)} & \text{$O (n)$} & \text{(Q)}& \text{Insertion sort} \\\hline \text{(C)}& \text{$O (n \log n)$} & \text{(R)} & \text{Binary search} \\\hline \text{(D)} & \text{$O (n^2)$} &\text{(S)} & \text{Merge sort} \\\hline \end{array}
GateOverflow

Q33.

Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then
GateOverflow

Q34.

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?
GateOverflow

Q35.

Which one the following in place sorting algorithms needs the minimum number of swaps?
GateOverflow

Q36.

Selection sort algorithm design technique is an example of
GateOverflow

Q37.

The average case and worst case complexities for Merge sort algorithm are
GateOverflow

Q38.

The usual \Theta (n^{2}) implementation of Insertion Sort to sort ab array uses linear search to identify the position where an element is to be inserted into the already sorted part of the array. If, instead, we use binary search to identify the position, the worst case running time will
GateOverflow

Q39.

A sorting technique is called stable if
GateOverflow

Q40.

Quick-sort is run on two inputs shown below to sort in ascending order taking first element as pivot (i). 1, 2, 3, \dots n (ii). n, n-1, n-2, \dots, 2, 1 Let C_1 and C_2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
GateOverflow