decode_bwt

Function decode_bwt 

Source
pub fn decode_bwt(bwt: &[u8]) -> Result<Vec<u8>>
Expand description

Decodes the original text from a given BWT.

It runs in O(n) time and O(n log n) bits of space, where n is the length of the text.

§Arguments

  • bwt - The Burrows-Wheeler transform of a text.

§Errors

An error is returned if the Burrows-Wheeler transform is invalid.

§Examples

use small_bwt::decode_bwt;

let bwt = "ard$rcaaaabb";
let decoded = decode_bwt(bwt.as_bytes())?;
assert_eq!(decoded, "abracadabra$".as_bytes());