Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2003 | Question 61

  • Difficulty Level : Medium
  • Last Updated : 28 Jun, 2021

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]


Answer: (B)

Explanation:

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :