Goal
How to encode the data that describes how to re-order a static list from a one order to another order using the minimum amount of data possible?
Algo part:
A reordering of a list is called permutation. Each permutation can be split into a set of loops, with each loop of N elements requiring (N - 1) swaps. For example
1, 2, 3, 4, 5, 6 --> 3, 2, 4, 1, 6, 5
This can be split into 1 - 4 - 3 (requires 2 swaps) 2 - 2 (0 swaps) 5 - 6 (1 swap)
To find a solution you can just pick any element at a wrong position and put it on its place.
Details part:
Of course, you can use smaller data types, RLE or some other encoding algorithms and so on.
Very theoretical but non-practical part.
All permutations of a sequence of N numbers can be lexicographically ordered, and one number from 0 to (N! - 1) is enough to represent the sequence. So, theoretically best answer is: compute the index of the permutation, transfer it, recreate the permutation by that index.