Hi all -
I'm looking for C or Python code to implement either of the two pseudocode functions:
function 1:
list1 = [0,1,2] #any list of single-integer elements
list2 = [0,3,4]
list3 = [0,2,4]
function1(list1, list2, list3)
>>> (0,3,2),(0,3,4),(0,4,2),(1,0,2),(1,0,4),(1,3,0),(1,3,2),(1,3,4),
(1,4,0),(1,4,2),(2,0,4),(2,3,0),(2,3,4),(2,4,0)
Basically, it's generating all permutations that are valid, as defined by having a) one element from each list and b) no elements with the same value.
function 2:
list1 = [(0,1),(0,2),(0,3)] #any list of double-integer tuples
list2 = [(0,4),(1,4),(2,4)]
function2(list1, list2)
>>> ((0,1),(2,4)) , ((0,2),(1,4)) , ((0,3),(1,4)) , ((0,3),(2,4))
Function 2 generates any permutation that has one tuple from each list and no elements within each tuple repeated.
I looked at the Python itertools help and couldn't find anything that replicated these pseudo-functions. Any ideas?
Thanks,
Mike