HomeAlgorithms & AISuffix Array Construction: Rank-Space Scatter (2D)

Suffix Array Construction: Rank-Space Scatter (2D)

2D key-space view of the O(n log n) prefix-doubling suffix array algorithm: every suffix is plotted as a point at its actual sort key (rank, rank+k), and a path traces the total order the algorithm derives from that scatter, round by round.

Algorithms & AI2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-suffix-array-string-matching-algorithm ↗ Open standalone

The same O(n log n) prefix-doubling construction as the 3D cube-row simulator, but rendered in the space where the algorithm actually operates: rank space. Every suffix becomes a point whose x-coordinate is its current primary rank and whose y-coordinate is the rank of the suffix k positions further along (or a special row once the window runs past the end of the string) — literally the (rank, rank+k) key pair the comparator sorts by. A white path traces the order the sort derives from that scatter, so watching the path straighten out round by round is watching the suffix array converge, while vertical bucket lines mark where dense ranks change. This is a genuinely distinct visual mechanism from the 3D version's physical re-sorting of rows — a key-space diagram, not a rotated camera — while running the identical rank/comparator-call bookkeeping underneath, so both simulators reach the same finished array in the same number of rounds.

⚙ Under the hood

2D key-space view of the O(n log n) prefix-doubling suffix array algorithm: every suffix is plotted as a point at its actual sort key (rank, rank+k), and a path traces the total order the algorithm derives from that scatter, round by round.

suffix arraystring algorithmssortingtext indexingbioinformaticsalgorithm visualization2D

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)