...
Question 9639 – Sorting
April 18, 2024
GATE 1992
April 18, 2024
Question 9639 – Sorting
April 18, 2024
GATE 1992
April 18, 2024

Sorting

Question 9

In a permutation a1…an of n distinct integers, an inversion is a pair (ai, aj) such that i<j and="" ai > aj.

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?

A
Θ(n2)
B
Θ(n log n)
C
Θ(n1.5)
D
Θ(n)
Question 9 Explanation: 
Here the inputs are to be restricted to 1…n with atmost ‘n’ inversions. Then the worst case time complexity of inversion sort reduces to Θ(n).
Correct Answer: D
Question 9 Explanation: 
Here the inputs are to be restricted to 1…n with atmost ‘n’ inversions. Then the worst case time complexity of inversion sort reduces to Θ(n).

Leave a Reply

Your email address will not be published. Required fields are marked *