Can anyone explain me the logic how to count number of permutations of any word? [Please explain instead of giving a program] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can anyone explain me the logic how to count number of permutations of any word? [Please explain instead of giving a program]

I'm writing the logic in java.

18th Aug 2022, 2:27 PM
I am offline
I am offline - avatar
6 Answers
+ 4
Snehil Pandey , are looking for a formula to calculate the number of permutations?
18th Aug 2022, 2:43 PM
Lothar
Lothar - avatar
+ 4
Have you learnt combinations and permutations yet? For any word consists of n unrepeat letter, the permutation is nPn = n!. For an example of n=4, the first place has 4 choices which are able to select, afterwards, the second place has 3, as a result, the permutation becomes 4*3*2*1=4!. If there are repeated letter, you can think of they can self rotate, permutation becomes n!/product(r!) of all pairs of repeated letters.
18th Aug 2022, 2:44 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
+ 2
Yes, if there are repeat, self cancellation occur, it's combinations are also rep!, and becomes the divisor.
19th Aug 2022, 8:38 AM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar
+ 1
Lothar No not any kind of formula but logic
19th Aug 2022, 1:48 AM
I am offline
I am offline - avatar
+ 1
abpatrick catkilltsoi Actually factorial of length is valid only for words having non repeated letters
19th Aug 2022, 1:51 AM
I am offline
I am offline - avatar
0
pretty wierd where are the answers? ? by ChillPill sir
20th Feb 2023, 2:07 PM
I am offline
I am offline - avatar