10

For each permutation $\sigma$ of $ \left\{ 1, 2, \dots, n \right\}$ define $$\operatorname{dist}(\sigma)=\sum_{i=1}^{n}\left| \sigma (i)-i \right|$$ For each $n\in\mathbb{N}$, I'm interested in finding the maximum value this function can score, namely $$M_n=\max_{\sigma\in D_n}\left\{\operatorname{dist}(\sigma)\right\}$$

Does $M_n$ has a conventional name? Uses? Is there a formula to find it?

I've noticed that $M_n$ grows "in pairs", meaning that for each odd $a\in \mathbb{N}$ it holds that $$M_{a+1}-M_a=M_{a+2}-M_{a+1}$$

I guess it can represent some kind of measure for hardness to sort.

Amihai Zivan
  • 2,874

1 Answers1

3

Let $n=2m$. Take any permutation where if $n\leq m$ then $\sigma(n)>m$ and if $n>m$ then $\sigma(n)\leq m$. Then $\sum_{(k=i)}^m|\sigma(m)-i|=\sum_{(k=i)}^m\sigma(m)-i=m^2$ and $\sum_{(i=m+1)}^{2m}|\sigma(m)-i|=\sum_{(i=m+1)}^{2m}i-\sigma(m)=m^2$.

Now suppose you have a permutation that does not satisfy this. Then it has a pair $i,j$ where $i,\sigma(i)\leq m$ and $j,(\sigma(j)>m$. Show switch $\sigma(i)$ and $\sigma (j)$ makes the distance sum larger.

Do the same for the other side to get:

For $n=2m+1$ this is $m(2m+2)$. For $n=2m$ this is $2m^2$

enter image description here For a geometrical interpretation See that if $\sigma(m)$ and $(m)$ and $\sigma(j)$ and $j$ are on different sides then the distance between them is more than $DE+FG$

Asinomás
  • 105,651
  • The distance doesn't necessarily grow if you swap $\sigma(m)$ and $\sigma(k)$, it can remain the same as well. For example, take permutation $3,4,1,2$ which also attains the maximum total distance. – Peter Košinár Dec 31 '13 at 20:05
  • Thanks, I think it is correct now. – Asinomás Dec 31 '13 at 20:27
  • @user4140 care to explain more? I didn't quite understand. – Amihai Zivan Jan 01 '14 at 08:44
  • 2
    If a permutation sends elements from one side to the other then they have the same distance sum. Suppose a permutation dos not send all elements in one side to the other. Then we have a pair of elements where $k,\sigma(k)\leq m$ and $j,\phi(j)>m$. I'll add a drawing. – Asinomás Jan 01 '14 at 15:44
  • 1
    FYI, the quantity $\operatorname{dist}(\sigma)$ is called Spearman's footrule distance. – Mike Spivey Jan 01 '14 at 21:39