GATE 2001
April 18, 2024Sorting
April 18, 2024Question 9639 – Sorting
In a permutation a1…an of n distinct integers, an inversion is a pair (ai, aj) such that i < j and ai > aj.
If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of 1…n ?
Correct Answer: B
Question 8 Explanation:
Probability of inverse (ai, aj(i<j) =="" n(n-1)="" 2
Probability of expected no. of inversions = (1/2) × (n(n-1)/2) = n(n-1)/4
Probability of expected no. of inversions = (1/2) × (n(n-1)/2) = n(n-1)/4
n(n-1)/2
n(n-1)/4
n(n+1)/4
2n[log2n]
