User blog:Leftunknown/Order function

Let's consider a function O(a), where 'a' is an array of numbers. The function then swaps two numbers at a time, using the most efficient method, ordering them from smallest to largest and outputs the amount of swaps it took.

O(5,3) = 1         (5,3 --> 3,5)

O(2,0,1) = 2      (2,0,1 --> 1,0,2 --> 0,1,2)

If we want to know what the largest output of a 3 element O(a,b,c) with a, b and c being equal to or smaller than n, we can write it as

$$O_n(a,b,c)$$

or without tex, simply as O[n](a,b,c).

O[0](x elements) = 0 (trivial)

O[n](a) = 0 (trivial)

O[x](x elements) to be continued