# Re: String Permutation

*From*: Ben Bacarisse <ben.usenet@xxxxxxxxx>*Date*: Thu, 07 Jun 2007 13:39:15 +0100

Gene <gene.ressler@xxxxxxxxx> writes:

On Jun 6, 1:02 pm, "Stuart" <stu...@xxx> wrote:<snip>

"Richard Heathfield" <r...@xxxxxxxxxxxxxxx> wrote in message

news:08mdnfdfWeQ8G_vbnZ2dnUVZ8qTinZ2d@xxxxxxxxx

<snip>

<snip>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?

<snip>The answer to both parts is yes!

<snip>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!

--

Ben.

.

**References**:**Re: String Permutation***From:*Gene

**Re: String Permutation***From:*CBFalconer

**Re: String Permutation***From:*Ben Bacarisse

**Re: String Permutation***From:*CBFalconer

**Re: String Permutation***From:*Ben Pfaff

**Re: String Permutation***From:*Richard Heathfield

**Re: String Permutation***From:*Stuart

**Re: String Permutation***From:*Gene

- Prev by Date:
**Re: Could you explain pass by value-result problem??** - Next by Date:
**Re: How to find offshore programming for simple project** - Previous by thread:
**Re: String Permutation** - Next by thread:
**Re: String Permutation** - Index(es):