Reconstruct a BWT

BANANA → sorted rotations → last column NNBAAA, primary=3.

The histogram remains A:3,N:2,B:1. What changed is order.

1 / 5

Label repeated occurrences

Last column NNBAAA; occurrence ranks 0,1,0,0,1,2.

Sorted column AAABNN; starts A=0,B=3,N=4.

LF = start[byte]+rank = [4,5,3,0,1,2].

2 / 5

Walk backward

Start at row 3. Visit 3,0,4,1,5,2.

Read A,N,A,N,A,B into output from right to left.

Recover BANANA. Matching repeated letters without their rank loses the permutation.

3 / 5

Move-to-front state

From initial bytes 0..255, NNBAAA gives ranks [78,0,67,67,0,0].

Zero means current front; a common symbol can still have a nonzero rank after another symbol moves.

RLE gives [78,-1,67,67,-2].

4 / 5

Pipeline boundary

PipelineEncode performs MTF then RLE only.

If BWT is added outside it, retain the primary index. Invert RLE → MTF → BWT.

For toy list [A,B,C], CACA gives [2,1,1,1].

5 / 5
←/→ or click edges to navigate · ? help · N notes · F fullscreen