00:01
So to find the number of inversions in this permutation, we have to count how many pairs of elements there are with a larger number on the left and smaller on the right.
00:10
So for example, the first one, a larger on the left would be five and a smaller on the right would be four.
00:15
So this would be plus one inversion.
00:18
So we'll just go through each value and count and add them up.
00:24
So we'll start with five.
00:26
We look at four and four is smaller than five.
00:29
So that's one.
00:30
Three is smaller than five, two is smaller in five, and one is smaller than five.
00:35
So all four of those pairs are inversions.
00:38
So that would be plus four...