I have list of product names names in text file. I need Delphi 7 function which returns me all possible product name combinations from list based to parameter selection.
It's enough if name exists once in the combination so name order has no matter(see sample results below).
Function must include parameter value where I can choose dynamically how many product names are used to create combinations.
Output needs to be printed to another text file or memo after iteration is made.
Note that amount of combinations can be huge(e.g. list of 200 products with 50 different combinations) so iterations must be done in memory. Also consider to use threads. Code must be fast !
Example product name list(txt file):
product1
product2
product3
product4
Example Result with two(2) product names:
product1, product2
product1, product3
product1, product4
product2, product3
product2, product4
product3, product4
Example result with three(3) product names:
product1, product2, product3
product1, product3, product4
product1, product2, product4
product2, product3, product4
...
...