Re: String Permutation

Gene <gene.ressler@xxxxxxxxx> writes:

On Jun 6, 1:02 pm, "Stuart" <stu...@xxx> wrote:
"Richard Heathfield" <r...@xxxxxxxxxxxxxxx> wrote in message


That appears to me to be a reasonable question. Here's another - can we
establish K for a given permutation? That is, without our crib list
(above), and given a given permutation, can we calculate what value
that permutation would have occupied in our list?
The answer to both parts is yes!

As a more interesting example consider BDAC;
=> [1][3][0][2]

1*3! => 6, [2][0][1], value = 6
2*2! => 4, [0][1], value = 10
0*1! => 0, [0], value = 10

So BDAC is at position 10 in the ordered permutations of ABCD (if we start
counting at 0).
For fun, think about going the other way: computing a map that takes
every permutation of <0,1,...N-1> to a unique integer in [0..(N-1)!] .

You missed the part where Stuart did that!