00:01
So to find the number of inversions in this permutation, 2, 4, 3, 1, we just have to go through each element and look how many elements to the right are smaller than that value.
00:10
Because the natural order is for smallest to largest, so when something's on the left is larger than the value on the right, then that's a permutation.
00:19
So for this permutation, the number of inversions is, we'll start counting with two.
00:26
So we look at four, and four is larger than two.
00:29
That's the natural order.
00:30
And three is larger than two, that's also the natural order, but one is less than two.
00:37
So for two, we have a value of one.
00:41
And now we'll look at four.
00:44
And when we look at four, we have this three to the right of it, and three is smaller than four...