As told by wikipedia the one in the title is a transform useful when compressing data.
I spent some minutes on writing these snippets for direct and inverse transformation.
May any wise monk help shrinking the code, I'd be thankful and glad to see the results :)
$/="";$l=length($w=<>);map{print+chop}sort+map{substr"$w\0$w",$_,$l+1} +0..$l push@w,split//for<>;map{@_=sort@_;$_[$_]=$w[$_].$_[$_]for+0..$#w}0..$# +w;print+grep{s/\0$//}@_
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Burrows-Wheeler transform
by moritz (Cardinal) on Jul 01, 2008 at 17:58 UTC | |
by shi (Novice) on Jul 01, 2008 at 18:18 UTC |
Back to
Cool Uses for Perl