https://github.com/pprattis/Permutations-and-Lexicographic-order
First program accepts as an input a permutation and prints the permutation rank in the lexicpgraphic order of all same length permutations. Second program accepts two integers n and k as inputs and prints the permutation of [n] which is at position k in the lexicographic order of all its permutations of [n].
https://github.com/pprattis/Permutations-and-Lexicographic-order
discrete-mathematics lexicographic-sort permutation-rank permutations program python student
Last synced: 5 months ago
JSON representation
First program accepts as an input a permutation and prints the permutation rank in the lexicpgraphic order of all same length permutations. Second program accepts two integers n and k as inputs and prints the permutation of [n] which is at position k in the lexicographic order of all its permutations of [n].
- Host: GitHub
- URL: https://github.com/pprattis/Permutations-and-Lexicographic-order
- Owner: PetePrattis
- License: mit
- Created: 2019-10-14T09:54:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T10:13:16.000Z (over 6 years ago)
- Last Synced: 2024-11-17T11:53:31.348Z (over 1 year ago)
- Topics: discrete-mathematics, lexicographic-sort, permutation-rank, permutations, program, python, student
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A Python Exercise
**This is a simple python project from my early days as a Computer Science student**
_This programm was created for the second semester class Discrete mathematics_
> #### Description of project
>
>>A program that accepts as an input a permutation in a list format from natural numbers separated by the space character (eg 7 10 9 11 2 1 3 5 6 8 4) and prints the permutation rank in the lexicographic order of all same length permutations.
>
>>A program that accepts two integers n and k as inputs and prints the permutation of [n] which is at position k in the lexicographic order of all its permutations of [n].
> #### About this project
>
> - The comments to make the code understandable, are within the .py archive
> - This program runs for Python version 3.6+
> - This repository was created to show the variety of the work I did and experience I gained as a student
>