Minimum amount of swaps needed to sort a stack
Your problem is known as Pancake sorting and it is not true that $f(n) &lt; n$. The minimum number of swaps is between $\frac{15n}{14}$ and $\frac{18n}{11}$.

Currently we know empirically that $P_{17} = 19$, which is the Pancake number, giving lower bound of 19 flips in the stack of 17 elements.

The sequence is known as AA058986.