Maximum of inversions

386 Views Asked by At

How can I smart find the formulary for maximum number of inversions? If I have n=1 I got $0$ inversion, if I have $n=2$ I got max $1$ inversions if for example {2,1}. If I have $n=3$ I got max $3$ inversions if for example {3,2,1} (because we have 3>2, 3>1, 2>1). If I have $n=4$ I got max $6$ inversions if for example {4,3,2,1} (because we have 4>3, 4>2, 4>1, 3>2, 3>1, 2>1). I think the formulary is n(n-1)/2. But How can I show this without induction

1

There are 1 best solutions below

1
On

The maximum number of inversions in a permutation occurs when every pair of numbers forms an inversion. Thus you only need to find how many pairs of numbers there are, which is $\frac{n(n-1)}{2}$. (Pick one number, pick a different number, and divide by 2 since this counts each pair twice.)