hi frndz....

i was wondering that given
1<n<1000000 &

how do i efficiently find nCr (combination) for any given values of n & r.

please help with an efficient algorithm...

8 Years
Discussion Span
Last Post by ayan2587

Please try to write some code first and then we can help you with that. Alternatively, write some pseudocode so we can see what conceptual issues you are having.


are those bits???
is n and r integers???

how about stating your problem clearly
and with your code...


Edited by iAmLast: n/a


I Would elaborate the question:

since n & r values could be very large, and in order to find nCr, n! & r! would have to be calculated, so it is not possible to define a datatype that can hold these factorial values...

instead what i planned to do was that in order to find the factorial, i could create an array, that could hold the values of the multiplication.

for ex: if i have to find 10!,
i wud create an array and store the values as
3 6 2 8 8 0 0 .
so instead of storing the whole value as some datatype, i can
store each value at continuous locations in the array.

but the problem here is, this method will have to be applied both in numerator & denominator, so what i am unable to figure out is how to solve it efficiently.

i hope the problem's much clearer now... :)

Edited by ayan2587: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.