Given an initial sequence of $n$ integers $(1,2,\ldots,n)$ and an ending sequence (which is a permutation of those $n$ integers), what is the minimum number of adjacent swaps involving the $n/2$ integers? (Assume $n \geq 2$ is a power of $2$). Note that the operation to get the final sequence is only by adjacent swaps.
For example when $n = 4$, if the ending sequence is $(4,3,1,2)$, then there have been a minimum of $3$ adjacent swaps involving the first $4/2 = 2$ integers.
Since we go
$(1,2,3,4) \rightarrow(1,2,4,3)$ ($4$ swaps with $3$, but the count is $0$ since we consider the first $4/2 = 2$ integers
$(1,2,4,3)\rightarrow (1,4,2,3)$ ($4$ swaps with $2$, and count is now $1$, since $4$ was in the first $2$ integers)
$(1,4,2,3) \rightarrow(4,1,2,3)$ ($4$ swaps with $1$, and count is now $2$, since $1$ is in the first $2$ integers)
$(4,1,2,3)\rightarrow(4,1,3,2)$ ($3$ swaps with $2$ but count is still $2$)
$(4,1,3,2) \rightarrow (4,3,1,2)$ ($3$ swaps with $1$ and count is incremented to $3$).
Let me know if any clarification is needed!
I've tried doing some recursion since it involves only the first $n/2$ integers, but no ideas from there. I thought I could use some combinatorial argument too but it gets messy when I test with $n\geq 8$.
Response to possible duplicate: I think mine is different. Mine only counts the number of operations in the first $n/2$ integers, whereas that gives a method for the entire string of integers. I'm having trouble finding a formula or function for the number of minimum operations.
I just edited my original post to explain why I think this is different. – Coins n Joins Jul 05 '19 at 14:59