Inversion of a word Created 2026-10-20 Updated 2026-11-05
For a word over a totally ordered alphabet, an inversion of a word is a pair of positions with . Equal symbols contribute no inversion of a word. In baba, with , the pairs are , so the word inversion number is three. Counting these pairs records distance from sorted order even when letters repeat; replacing the letters by distinct ordered labels gives the inversion of a permutation case.