in reply to Re^2: Is it possible to make reference to substrings and sort them?
in thread Is it possible to make reference to substrings and sort them?
Good call on doubling the string. Though the Schwartzian seems unnecessary here:
my $text2 = "$text$text"; my $tlen = length($text); my $bwt7 = join('', map{ substr($$_, -1) } sort{ $$a cmp $$b } map{ \substr($text2, $_, $tlen) } 0..$tlen-1 ); print "$text: $bwt7\n";
Intermediate array of references consumes more memory than an array of offsets would, I think, but is faster to sort. Something to test and benchmark...
|
|---|