Re: Generating the ith permutation of N elements

"[email protected]" <[email protected]> Tue, 1 Jun 2010 19:34:31 +0100 (BST)
Newsgroups gmane.games.devel.algorithms
Message-ID <99976243.274959.1275417271881.JavaMail.open-xchange@oxltgw00.schlund.de>
One mapping is to convert your index i to base-e for e elements.
That's surjective/onto.
But IIR discrete maths there's more than one definition of ith permutation

 

On 01 June 2010 at 18:57 Yannick Letourneau <[email protected]>
wrote:

> I'm looking for a way to generate the ith permutation of N elements, at
> approximately O(N) cost.
>
> All algorithms I've seen need the (i-1)th permutation in order to derive the
> ith permutation from it (e.g. they work incrementally).
>
> I would just like to give it a number in the range
>
> 0 <= i < N!
>
> and it would spit out the ith permutation, without requiring to compute the
> ones that come before it (which would be O(N!) ).
>
> Is that possible ?
>
> Any pointers appreciated.
>
> Yannick

------------------------------------------------------------------------------

_______________________________________________
GDAlgorithms-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list