Burrows-Wheeler Transform

Input7/20
input
rotating
sorting
extracting
done
FastSlow
Time Complexity
Best
O(n log n)
Average
O(n log n)
Worst
O(n²)
Space Complexity
O(n)
StabilityFALSE
In-placeFALSE

Explanation

The Burrows-Wheeler Transform (BWT) reversibly rearranges a string by generating all its rotations, sorting them lexicographically, and outputting the last column. The resulting string tends to have runs of identical characters, making it highly compressible.

Pseudo Code

1function BWT(S):
2 rotations = []
3 for i = 0 to |S|-1:
4 rotations.append(S[i:] + S[:i])
5 rotations.sort()
6 return last column of each row
Sponsor Ad