Subj : Re: Algorithm to generate permutation for a non sequential single To : comp.programming From : Thad Smith Date : Fri Jul 01 2005 02:37 pm mmarin1m@hotmail.com wrote: > Hi all, > > I'm looking for an algorithm that would generate all permutations for a > given non sequential list. As an example: > > Given the list 125, 126, 5, 88 and 33, all permutations must be > generated in that sequence. > > The perfect algorithm would yields the following matrix: > > 125, 126, 5, 88, 33 > 125, 126, 5, 88 > 126, 5, 88, 33 > 125, 126, 5 > 125, 126, 88 > 125, 126, 33 > 125, 5, 88 > 125, 5, 33 > 125, 88, 33 > 126, 5, 88 > 126, 5, 33 > 126, 88, 33 > 5, 88, 33 > 125, 126 > 125, 5 > 125, 88 > 125, 33 > 126, 5 > 126, 88 > 126, 33 > 5, 88 > 5, 33 > 88, 33 > 125 > 126 > 5 > 88 > 33 What you have illustrated is subsets of the original set, not permutations. Are the subsets {125,126,5,33}, {125,126,88,33}, and {125,5,88,33} intentionally missing from the output of the perfect algorithm? If not, Richard's suggestion of binary mapping should work well. Thad .