Jump to content

Suffix tree: Difference between revisions

m
→‎{{header|Perl 6}}: flatten output from 'map'
m (→‎{{header|Sidef}}: minor simplifications)
m (→‎{{header|Perl 6}}: flatten output from 'map')
Line 236:
 
=={{header|Perl 6}}==
{{Works with|rakudo|2017-01}}
 
Here is quite a naive algorithm, probably <math>O(n^2)</math>.
 
<lang Perl 6>multi suffix-tree(Str $str) { suffix-tree flat map &flip, [\~] $str.flip.comb }
multi suffix-tree(@a) {
hash
2,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.