nextperm
Using lexical order on the set {1, 2, ..., N}, outputs the next permutation of the ordered tuple x. You have exhausted the list when All(nextperm(x,N) == x) is TRUE.
For example
nextperm([1 5 4], 5) returns [2 1 3]
nextperm([2 1 3], 5) returns [2 1 4]
nextperm([5 4 3], 5) returns [5 4 3]
Citar como
Steven Gregory (2025). nextperm (https://www.mathworks.com/matlabcentral/fileexchange/22692-nextperm), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- MATLAB > Mathematics > Linear Algebra >
Etiquetas
Agradecimientos
Inspirado por: modinv(x, N), logmod
Inspiración para: Fast batch generation of permutations, logmod, modinv(x, N), egcd.m
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.