Take the 2-minute tour ×

Is there a nice implementation of suffix trees in JavaScript? Something that will take a string (and a separator) and make the appropriate suffix tree?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Probably the most know implementation: http://felix-halim.net/pg/suffix-tree/index.php. But you want to search for an alternative at google site:www.cut-the-knot.org suffix-tree, too. You want too look for Matt Mahoney tutorial about the suffix-tree, too. The best tutorial on the net from a compression expert with source code in c.

share|improve this answer
Thanks! It's quite easy to understand what it's doing and modify it for my purposes. –  silverasm Apr 21 '11 at 15:20

Here's another implementation I wrote:


share|improve this answer
Cool, thanks eikes! –  silverasm Aug 17 '12 at 21:51

find another implementation (ukkonen's) here: http://code.google.com/p/text-indexing/ ; suffixtree.JS is provided along with a HTML visualization

share|improve this answer

Your Answer


