# Sorting

 Question 1
Consider the following array.

$\begin{array}{|l|l|l|l|l|l|l|l|} \hline 23&32&45&69&72&73&89&97 \\ \hline\end{array}$

Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
 A Selection sort B Mergesort C Insertion sort D Quicksort using the last element as pivot
GATE CSE 2021 SET-1   Algorithm
Question 1 Explanation:
 Question 2
Of the following sort algorithms, which has execution time that is least dependant on initial ordering of the input?
 A Insertion sort B Quick sort C Merge sort D Selection sort
ISRO CSE 2020   Algorithm
Question 2 Explanation:
 Question 3
An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is _________.
 A 0.08 B 0.0016 C 0.04 D 0.0008
GATE CSE 2019   Algorithm
Question 3 Explanation:
 Question 4
Of the following sorting algorithms, which has a running time that is least dependent on the initial ordering of the input?
 A Mege Sort B Insertion Sort C Selection Sort D Quick Sort
ISRO CSE 2018   Algorithm
Question 4 Explanation:
 Question 5
Given two sorted list of size m and n respectively. The number of comparisons needed the worst case by the merge sort algorithm will be:
 A m-n B maximum of m and n C minimum of m and n D m+n-1
ISRO CSE 2018   Algorithm
Question 5 Explanation:
 Question 6
The number of swappings needed to sort the numbers 8 , 22, 7, 9, 31, 5, 13 in ascending order using bubble sort is
 A 11 B 12 C 13 D 10
ISRO CSE 2017   Algorithm
Question 6 Explanation:
 Question 7
Which one of the following in-place sorting algorithms needs the minimum number of swaps?
 A Insertion Sort B Quick Sort C Heap Sort D Selection Sort
ISRO CSE 2017   Algorithm
Question 7 Explanation:
 Question 8
Algorithm design technique used in quicksort algorithm is?
 A Dynamic programming B Backtracking C Divide and conquer D Greedy method
ISRO CSE 2016   Algorithm
Question 8 Explanation:
 Question 9
Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in ascending order, which of the following are TRUE?
I. Quicksort runs in $\Theta (n^{2})$ time
II. Bubblesort runs in $\Theta (n^{2})$ time
III. Merge sort runs in $\Theta (n)$ time
IV. Insertion sort runs in $\Theta (n)$ time
 A I and II only B I and III only C II and IV only D I and IV only
GATE CSE 2016 SET-2   Algorithm
Question 9 Explanation:
 Question 10
The worst case running times of Insertion sort, Mergesort and Quicksort, respectively, are:
 A $\Theta$(n logn), $\Theta$(n logn), and $\Theta(n^{2})$ B $\Theta (n^{2}),\Theta(n^{2}), and \Theta (n logn)$ C $\Theta (n^{2}),\Theta(n logn), and \Theta (n logn)$ D $\Theta (n^{2}),\Theta(n logn), and \Theta (n^{2})$
GATE CSE 2016 SET-1   Algorithm
Question 10 Explanation:
There are 10 questions to complete.

### 3 thoughts on “Sorting”

1. Question number 17 option d should be n^3 instead of n ^2