GATE | GATE-CS-2003 | Question 61
In a permutation a1…..an 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]
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
My Personal Notes arrow_drop_up
Please Login to comment...