Algorithm - generating all combinations from items that must be chosen in sequence
问题 I'm looking to find out if a particular algorithm already exists. I want to use it in an application, but I've also seen this come up in several Project Euler problems too. I'm looking to calculate a specific type of permutation/output set, where the next item chosen must be one from a finite set of options in only the following set. For example, say I've got 3 arrays $a1 = array("a", "b", "c"); $a2 = array("d", "e", "f"); $a3 = array("g", "h", "i"); I'm looking to generate all the