I need an algorithm that generates all possible combinations in any programming language.
Ok, here is a single line solution in Haskell:
import Data.List (subsequences) n `outOf` xs = filter ((n ==) . length) (subsequences xs) test = 4 `outOf` ["A", "B", "C", "D", "E", "F"] *Main> test [["A","B","C","D"],["A","B","C","E"],["A","B","D","E"],["A","C","D","E"],["B","C ","D","E"],["A","B","C","F"],["A","B","D","F"],["A","C","D","F"],["B","C","D","F "],["A","B","E","F"],["A","C","E","F"],["B","C","E","F"],["A","D","E","F"],["B", "D","E","F"],["C","D","E","F"]] *Main> length test 15