# Bookmarking A Combination Algorithm?

This topic is 4581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a method that calculates C(n, r) for an array of indices. No big deal. The problem is that I want to run this calculation asynchronously, because the size of possible combinations is too large a) to wait for, and b) to initialize an array to store it. For example if you were building a poker odds calculator, you'd notice that to find all combinations of you, and an unknown player showing down to the river, you'd have this on your hands: 1. C(52, 2) : deal your hand, which is known; this is for reference only. 2. C(50, 2) * C(48, 5) : deal your unknown opponent, then the board cards. ------------------- 1225 * 1712304 = 2097572400 combinations Obviously you can't work with that kind of size with a single synchronous call to a combination method. My question is whether the concept of factoradics (in short, serializing a combination to a unique int) could be applied here to give that method, or a derived method, a "bookmark" to get back to the combination task at hand, which would allow it to process, say, one million combinations at a time, but know where it left off and still be able to access each combination in case we're not dealing with int arrays but references to objects -- I know we can't keep them around but can we reconstruct them dynamically from a factoradic index? I guess I'm looking for some help visualizing what this would look like, and how one could manage the combination method to be able to process example 2. (two combinations that depend on each other, i.e. a foreach in C#) so that it could be run asynchronously.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633735
• Total Posts
3013592
×