Prefix doubling, rank pairs, and lexicographic order in one animated view.
Watch the prefix-doubling algorithm re-rank all suffixes as the compared prefix length grows from 1 to 2, 4, and beyond. Each step exposes the rank pair (rank[i], rank[i + k]) used to sort suffixes without comparing full strings.
Enter a string, preferably ending with a unique sentinel like $, then start the animation.
Each card anchors one suffix start position.
The current phase sorts suffixes by (rank[i], rank[i + k]).
| # | Index | Suffix | Rank Pair | New Rank |
|---|
Auto-play and step mode use the same discrete snapshots.
The suffix array is the sorted list of starting indices. LCP comes from Kasai's scan.