generate a new list with that element and the permutations of the list except that element (recursive), return the new list
perm(l)
if len(l) = 0:
return []
elif len(l) == 1:
return [l]
else
P = []
for e in l:
v = l\e
P.add ( [e] + perm(v) )
return P
Aucun commentaire:
Enregistrer un commentaire