Skip to content

Instantly share code, notes, and snippets.

@fjyuu fjyuu/bwt-decode.pl
Created Nov 13, 2012

Embed
What would you like to do?
Code Golf of Burrows-Wheeler Transform
#!perl -pl
$n=index$_,"[";y/[]//d;@c=split//;@i=sort{$c[$a]cmp$c[$b]}0..$#c;$_=join"",map{$c[$n=$i[$n]]}@c
#!perl -palF""
@i=sort{"@F[$a..$#F] @F[0..$a-1]"cmp"@F[$b..$#F] @F[0..$b-1]"}0..$#F;$_=join"",map{$_--?"$F[$_]":"[$F[$_]]"}@i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.