Skip to content
StackDecode
StringsExplained

Suffix Tree

A compressed trie of all suffixes.

Time

O(n) build (Ukkonen)

Extra space

O(n)

Use it for

Fast substring queries, longest repeated substring.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.