0
Is there a way to calculate permutations and combinations?
Help me with a code that can calculate permutations and combinations of a given problem
2 Respostas
+ 9
U can make your methods for calculating permutaion & combination
● make a method for calculating factorial
● for nCr , calculate n!/[(n-r)!.(r)!]
● for nPr , calculate n!/(n-r)!
//U can also calculate nPr first & then use it to calculate nCr
fast way to calculate combination :
● make use of formula nCr = (n/r). (n-1)C(r-1) & recursion
0
Thank you mam