Permutation generation by insertion
ID: permutation-generation-by-insertion
Generate every permutation of a finite list by recursively permuting its tail and inserting its head into each possible position. For distinct input elements, every shorter permutation has insertion positions, giving results. Removing the distinguished head reconstructs the unique shorter permutation and insertion position.
New to topics? Read the docs here!