Heap's algorithm generates all possible permutations of n objects. The algorithm minimizes movement: it generates each permutation from the previous one by interchanging a single pair of elements
See Wikipedia.
Heap's algorithm generates all possible permutations of n objects. The algorithm minimizes movement: it generates each permutation from the previous one by interchanging a single pair of elements
See Wikipedia.