GATE 2001
April 18, 2024
Sorting
April 18, 2024
GATE 2001
April 18, 2024
Sorting
April 18, 2024

Question 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
A
n(n-1)/2
B
n(n-1)/4
C
n(n+1)/4
D
2n[log2n]

Leave a Reply

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