Purpose: The first linear-time suffix tree construction (1973). Donald Knuth called it “the algorithm of the year 1973.” It builds the tree by prepending characters — inserting suffixes from shortest to longest, i.e. processing the string right to left.

Algorithm

Process the string from the last character backwards. At each step, the tree contains all suffixes of the current suffix of , and one more suffix is added by prepending a character.

Two auxiliary tables per node and character :

  • link vector — a boolean: does occur as a substring?
  • indicator vector — a pointer: the node for , if that node exists.

These are exactly the reverse of Ukkonen’s and McCreight’s suffix links: they answer “where does prepending take me?” rather than “where does dropping the first character take me?”

Insertion walks up from the previously inserted leaf using and until it finds where the new suffix branches off, then splits an edge and adds a leaf.

Complexity

  • Time: for a constant alphabet
  • Space: for the two tables — this is the problem. For that is a 256× blowup versus McCreight.

Why it was superseded

The tables made Weiner’s algorithm impractical for anything but tiny alphabets. McCreight (1976) achieved the same time with space by reversing the direction of construction, and Ukkonen (1995) added online construction. Weiner’s algorithm survives as a historical landmark and as the conceptual ancestor of the suffix automaton, whose suffix links point in the same “prepend” direction.

The connection worth knowing

Weiner’s prepend-based view is precisely the view a suffix automaton of the reversed string takes. Concretely:

The suffix link tree of the suffix automaton of is the suffix tree of .

This is why the suffix automaton — 30 lines, online, or — is the modern practical answer to almost every suffix-tree problem. It is Weiner’s idea in a form that is easy to implement.

History of linear suffix structures

YearResult
1973Weiner — first linear suffix tree, space
1976McCreight — linear time, space
1983Blumer et al. — the DAWG / suffix automaton
1990Manber-Myers — suffix arrays in , far less memory
1995Ukkonen — online linear construction
1997Farach — linear for integer alphabets
2003DC3 — simple linear suffix array
2009SA-IS — fast linear suffix array, the current standard

Variants / Use Cases

  • Suffix automaton — the practical modern descendant; use this
  • Ukkonen — if you genuinely need an explicit suffix tree, built online
  • Suffix Tree — what the structure is good for