Data Structures & AlgorithmsVery hardICPC regional · strings

Problem: What is the time complexity of building a suffix tree of a string of length n over a fixed alphabet with Ukkonen's online algorithm?

  1. A. O(n log n)
  2. B. O(n)
  3. C. O(n^2)
  4. D. O(n sqrt n)

Correct answer: B. O(n)

Ukkonen adds one character at a time with amortised constant work per extension for a fixed alphabet, giving linear time overall.

More Coding Interview Problems questions

Exams that ask this topic