Chris is given a list of numbers to sort in ascending order. He was told that swapping any two elements incurs a cost of \((i-j)^{2}\) (\(i\) and \(j\) are the indices of the elements respectively). What is the minimum cost for Chris to sort the given list?

As an explicit example, for the list `1 3 2`

the minimum cost is 1.

×

Problem Loading...

Note Loading...

Set Loading...