in reply to sort with fewest moves

`move(n, m)`".

This sounds alot like Bubble Sort to me.

The distinction being that Bubble Sort is usually defined in terms
of a ` swap(a, b)` method which is considered
atomic. Since ` swap`) can be (and frequently is)
defined in terms of two moves that use a temp variable,
Bubble Sort can solve your problem given your constraints --
uut it will never come close to a solution with a minimal
number of moves.
It will only ever call ` move(a, 0)` and
` move(0, a)`.

I can't think of any other constant space sorting
algorithms
(that operate on arrays). But one extremely important
question that needs to be answered before you can even
try to for finding an optimal algorithm is:
how do you define optimal? is `move(n,m)`
the only operation with a "cost" ? what about doing
comparispons or slots? Would a solution that analyzed all
of the slots in detail first,then built up a list of
moves be considered optimal?

(I ask, because you're post only refers to the ideal
situation being one in which "the number of **moves**
is minimal.")