GATE CS 2003 · Insertion Sort

MCQ · 1 mark · Problem PROG-SORT-0056

In a permutation \(a_1.....a_n\) of n distinct integers, an inversion is a pair \((a_i, a_j)\) such that \(i \lt j\) and \(a_i \gt a_j\). What would be the worst case time complexity of the insertion Sort algorithm, if the inputs are restricted to permutations of 1....n with at most n inversions?
  1. A
    \(\Theta (n^{2})\)
  2. B
    \(\Theta (nlogn)\)
  3. C
    \(\Theta (n^{1.5})\)
  4. D
    \(\Theta (n)\)

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option D.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/43576/gate2003-62

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com