ToLehmerCode
Entry i counts the later entries smaller than p(i).
ToLehmerCode(Permutation)Entry i counts the later entries smaller than p(i).Typed signatures
| Type | Package | Applies |
|---|---|---|
(permutation) -> permutation_inversion | combinatorics | always |
Details
- Takes a
Permutationand returns aPermutationInversion— a typed map, so a wrong carrier is a type error rather than a wrong answer. - Its total is the inversion count, which is the Lehmer code's whole point.
Examples
About
| Examples | 1 |
|---|---|
| Crosswalk | WikipediaWikidataRosetta Code |