The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



NextPermutation


Unit:SDL_dstruct
Class: none
Declaration: function NextPermutation (var CurrentPermut: TCombination): boolean;

The function NextPermutation successively calculates all possible permutations of non-repeating digits. The width of the permutation (= the number of 'digits' in the permutation) is defined by the element at address 0 of the array CurrentPermut (which can be seen as a string of 'digits' with its length byte at the position 0). NextPermutation returns a TRUE value as long as there are further permutations available.

Hint: In order to get the complete set of permutations, CurrentPermut should be initialized to the permutation [1,2,3,..,x], with x being the width of the permutation.



Last Update: 2023-Feb-06