Find n-th permutation in reverse order

177 Views Asked by At

Problem: If we have a set of letter: {A,D,E,I,K,M,O,T}. Problem is to find which permutation is "METODIKA". alphabetically (lexicographic order)

Solution is to see that if we write first letter A we then write 7! combinations. After A we write D again 7! combinations... When we can to letter M we write $5\cdot$ 7! combinations. That's idea for the fist letter and we keep going until last letter.
Solution is 27346.
My question is: if we know that we can have 8!(40 320) combinations, is there a way to count permutations not from begin but form the end to begin. Because 27346 is bigger than 40320/2 and we will must count smaller number of combinations?