• edited by
17,890 views
40 40 votes

The worst case running times of Insertion sort , Merge sort and Quick sort, respectively are:

  1. $\Theta (n \log n)$, $\Theta (n \log n)$ and $\Theta(n^2)$
  2. $\Theta (n^2)$, $\Theta (n^2)$ and $\Theta(n \log n)$
  3. $\Theta (n^2)$, $\Theta (n \log n)$ and $\Theta (n \log n)$
  4. $\Theta (n^2)$, $\Theta (n \log n)$ and $\Theta (n^2)$

4 Answers

Best answer
50 50 votes

Answer is D.

Insertion sort:  $=  \Theta(n^2)$

Merge sort:      $=  \Theta(n\log n)$

Quick sort:       $=  \Theta (n^2)$

Note : here $\Theta$ is not average case since question asked worst case so $\Theta$ represent worst case only

• edited by
2 2 votes
Insertion Sort Worst-Case time complexity=O(n^2)

Merge Sort Worst-Case time complexity=O(nlogn)

Quick Sort Worst-Case time complexity=O(n^2)

Option D is correct
1 1 vote

Insertion Sort: O(n²)
-

In the worst case (when the array is in reverse order), each element has to be compared with and shifted past all previously sorted elements. This results in about n² comparisons and shifts.

Merge Sort: O(n log n)
-
Merge Sort in all the case takes O(n log n) time.

Quick Sort: O(n²)
-
In the worst case (such as when the pivot is always the smallest or largest element), the array is divided into very unbalanced parts (1 and n−1 elements). This leads to O(n²) comparisons.

So the answer is option $(D)$.

Answer:
Position:
Show:

Related questions

9 9 votes
6 6 answers
4.0k
4.0k views
Arjun asked Feb 27, 2025
3,951 views
Suppose that insertion sort is applied to the array $[1,3,5,7,9,11, x, 15,13]$ and it takes exactly two swaps to sort the array. Select all possible values of $x$.$10$$12...
58 58 votes
7 answers 7 answers
20.5k
20.5k views
Sandeep Singh asked Feb 12, 2016
20,504 views
Let $X$ be a recursive language and $Y$ be a recursively enumerable but not recursive language. Let $W$ and $Z$ be two languages such that $\overline{Y}$ reduces to $W$,...
28 28 votes
5 answers 5 answers
11.9k
11.9k views
Sandeep Singh asked Feb 12, 2016
11,909 views
Consider that $B$ wants to send a message $m$ that is digitally signed to $A$. Let the pair of private and public keys for $A$ and $B$ be denoted by ${K_{x}}^-$ and ${K_{...
52 52 votes
4 answers 4 answers
23.4k
23.4k views
Sandeep Singh asked Feb 12, 2016
23,400 views
Consider a computer system with $40$-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one-level page table per process and each pag...