Abstract
Subroutines for generating and indexing permutations are described. The first generates a permutation of N integers, depending on the value of an index that may take on values between 1 and N!, the number of possible permutations of length N. The second subroutine calculates an index from a given permutation that denotes its position in the list of all possible permutations of that length. The last subroutine generates random permutations of any given length.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.