I'm having n inputLists with items. Now I want to calculate resultLists (of length n) containing all combinations of items in the original inputLists (taking one item of each inputList).
I think I should provide an example here (n=3):
inputList1: [item1, item2, item3]
inputList2: [item4]
inputList3: [item5, item6]
resultList1: [item1, item4, item5]
resultList2: [item1, item4, item6]
resultList3: [item2, item4, item5]
resultList4: [item2, item4, item6]
resultList5: [item3, item4, item5]
resultList6: [item3, item4, item6]
I'm feeling kind of stupid, but I have no idea how to implement (C++) a function creating these results for any n and any inputList lengths. I think I should use some sort of recursion, but I don't know how.
Any ideas?