Burrows–Wheeler transform
hard 12 minSort every rotation of a marked string and keep the last column.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
Rotate, sort, read the rim; match ranks to rewind.
Write the block on a paper ring. Every sorted window has a letter just behind it, and those letters around the rim form the transform.
Cheat sheet
- Encode
- Last column of sorted rotations
- Seed row
- Index of $ in Last
- LF target
- First offset + earlier copies