# Answer to Question #62768 in C++ for Hope

Question #62768

how to use a Factorial Number System for string in c++ ....?

As an example, say we want the 100th permutation of ABCDEF. We write 100 as

0×5!+4×4!+0×3!+2×2!+0×1!0×5!+4×4!+0×3!+2×2!+0×1!

Building up the permutation one letter at a time:

0th element of [ABCDEF] = A

4th element of [BCDEF] = F

0th element of [BCDE] = B

2nd element of [CDE] = E

0th element of [CD] = C

last elemnet = [D]

As an example, say we want the 100th permutation of ABCDEF. We write 100 as

0×5!+4×4!+0×3!+2×2!+0×1!0×5!+4×4!+0×3!+2×2!+0×1!

Building up the permutation one letter at a time:

0th element of [ABCDEF] = A

4th element of [BCDEF] = F

0th element of [BCDE] = B

2nd element of [CDE] = E

0th element of [CD] = C

last elemnet = [D]

Expert's answer

#### Not answered

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment