All possible combinations of n items selected randomly from a set of x items (algorithm)
- by SubPortal
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.