Perl ã«ãã Suffix Array ã®å®è£ 2006-04-10-2 [Programming][Algorithm] æä½ã£ããPerlã«ããsuffix arrayã®å®è£ ããçºæããã®ã§å ¬éãã¦ãã ã¾ãã ã½ã¼ã¹ã³ã¼ãã§ãã #!/usr/bin/perl -w use strict; my $t = "mississippi"; # Text - 対象ããã¹ã my @sa = (0..length($t)-1); # Suffix Array - åæè¨å® ### Suffix Array ã®ä½æ @sa = sort {substr($t, $a) cmp substr($t, $b)} @sa; # ãã¹ãåºå for (0..$#sa) { print "$_ $sa[$_] ",substr($t, $sa[$_]),"\n"; } ### ãã¤ããªãµã¼ãã«ãã
{{#tags}}- {{label}}
{{/tags}}