Answer by Xi'an for number to unique permutation mapping of a sequence...
As I was unsure of the code in gbronner's answer (or of my understanding), I recoded it in R as follows ritpermz=function(n, parclass){ return(factorial(n) / prod(factorial(parclass)))} rankum <-...
View ArticleAnswer by gbronner for number to unique permutation mapping of a sequence...
From Permutation to Number: Let K be the number of character classes (example: AAABBC has three character classes) Let N[K] be the number of elements in each character class. (example: for AAABBC, we...
View ArticleAnswer by Henry for number to unique permutation mapping of a sequence...
Here is an algorithm in Java that enumerates the possible sequences by mapping an integer to the sequence. public class Main { private int[] counts = { 3, 2, 1 }; // 3 Symbols A, 2 Symbols B, 1 Symbol...
View ArticleAnswer by Kaganar for number to unique permutation mapping of a sequence...
Assuming the resulting number fits inside a word (e.g. 32 or 64 bit integer) relatively easily, then much of the linked article still applies. Encoding and decoding from a variable base remains the...
View ArticleAnswer by Mihai8 for number to unique permutation mapping of a sequence...
A very simple algorithm to mapping a number for a permutation consists of n digits is number<-digit[0]*10^(n-1)+digit[1]*10^(n-2)+...+digit[n]*10^0 You can find plenty of resources for algorithms to...
View Articlenumber to unique permutation mapping of a sequence containing duplicates
I am looking for an algorithm that can map a number to a unique permutation of a sequence. I have found out about Lehmer codes and the factorial number system thanks to a similar question, Fast...
View Article