GATE | GATE-CS-2003 | Question 61

In a permutation a1… of n distinct integers, an inversion is a pair (ai, aj) such that i aj. If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of 1…..n ?
(A) n(n – 1)/2

(B) n(n – 1)/4
(C) n(n + 1)/4
(D) 2n[log2 n]

Answer: (B)


There are n(n-1)/2 pairs such that i < j.

For a pair (ai, aj), probability of being inversion is 1/2.

Therefore expected value of inversions = 1/2 * (n(n-1)/2)
                                       = n(n-1)/4

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :


Please write to us at to report any issue with the above content.