Which permutation am I? Or: what is a bijection $f:S_n \rightarrow \{1,2,\ldots,n!\}$ such that we can compute $f(\beta)$ easily?

54 Views Asked by At

Let $S_n$ be the symmetric group on $\{1,2,\ldots,n\}$ and assume that $S_n$ is ordered in some way, i.e., $$S_n=\{\alpha_1,\alpha_2,\ldots,\alpha_{n!}\}.$$ We are able to choose this ordering on $S_n$, and should do so to make the problem easier.

Question: Suppose we have a permutation $\beta \in S_n$ and want to compute $i$ such that $\beta=\alpha_i$. How can we do this efficiently?

Essentially, I want a bijection $f:S_n \rightarrow \{1,2,\ldots,n!\}$ such that I can compute $f(\beta)$ easily.

This is for a potential cryptographic application, but it's in the "brainstorm" stage at the moment, so I won't bother describing it. This is a proof-of-concept for that application (i.e. if this doesn't work, it's likely that what I have in mind won't work either). If it makes any difference, $n$ will be fixed and around $10$ to $20$.

1

There are 1 best solutions below

0
On

Some kind of lexicographic ordering: I will illustrate this for n=4 (partially!) That is first list all permutations starting with 1. There are 6 of them, and so those with 2 at 2nd position come first, and then those with 3 at 2nd position: We use recursion to list them, [1,2,3,4], [1,2,4,3], [1,3,2,4],[1,3,4,2]

Now the 6 permutations with 2 at first: [2,1,3,4], [2,1,4,3], [2,3,1,4], [2,3,4,1]

and so on.