Knuth's method of renaming a permutation

336 Views Asked by At

On page 46 of Volume 1 of Knuth's The Art of Computer Programming he mentions a permutation of 231, and how to go from (1,2,3) to (1,2,3,4) (from n-1 to n objects).

In method 2 he goes says:

$$2\;3\;1\;\tfrac{1}{2},\quad 2\;3\;1\;\tfrac{3}{2},\quad 2\;3\;1\;\tfrac{5}{2}, \quad2\;3\;1\;\tfrac{7}{2}$$ and, renaming, we get $$3\;4\;2\;1,\quad 3\;4\;1\;2,\quad 2\;4\;1\;3,\quad 2\;3\;1\;4.$$

How? How do you get the second row from the first one?

1

There are 1 best solutions below

1
On BEST ANSWER

The crucial sentence reads Then rename the elements of each permutation using the numbers $1,2,\dots n$ preserving order.

In the first permutation, $\frac{1}{2}$ is the smallest number so it becomes $1$, and therefore the others are renamed as $1\rightarrow 2, \;2\rightarrow 3, \; 3\rightarrow 4\,$ and the permutation becomes $3 \; 4\; 2\; 1$.

In the second permutation, $\frac{3}{2}$ is the between $1$ and $2,$ therefore it becomes 2, and the others are renamed as $1\rightarrow 1, \;2\rightarrow 3, \; 3\rightarrow 4\,$ and the permutation is $3 \; 4\; 1\; 2$.

I guess you can see how to get the other two permutations.