All possible combinations of n items selected randomly from a set of x items (algorithm)
Posted
by SubPortal
on Stack Overflow
See other posts from Stack Overflow
or by SubPortal
Published on 2010-04-15T06:28:58Z
Indexed on
2010/04/15
6:33 UTC
Read the original article
Hit count: 448
I have a set of x string items e.g("A","B","C","D","E","F") I need to know the formula that calculates how many combinations of n items and what is the algorithm that generates all possible combinations e.g if we need to select 4 items from the list randomly. those 4 items could be: ("A","B","C","D") or ("A","B","C","E") or ("A","B","C","F") or ("A","B","D","E") ...etc I need the formula that calculates how many sets of items will be generated without repetition, that is we consider ("A","B","C","D") as one of the resulted combinations we cannot consider the same items as another resultant combination with replacing the positions of the items in the set like ("A","B","D","C") Also I need the algorithm that generates all possible combinations in any programming language. [C#,VB.NET,Java,C++]
Thank you for any help.
© Stack Overflow or respective owner