1

Let's say that we have computed a suffix tree in O(n) time, and wish to use this to create a suffix array. According to wikipedia:

A suffix tree can be built in $O(n)$ and can be converted into a suffix array by traversing the tree depth-first also in $O(n)$, so there exist algorithms that can build a suffix array in $O(n)$.

but in order to do this, the suffix tree must be traversed in lexicographical order. It is my understanding, that in order to do this, at each depth you must sort the outgoing edges and pick whichever is lexicographically the smallest, which would mean ultimately you end up sorting the entire alphabet (denoted as $k$) of whatever string you constructed the tree from, so hence $O(nk\log k)$ (assuming a well picked sorting algorithm).

I don't see how you could construct the suffix array in $O(n)$ time, even if when creating the suffix tree you sorted the edges, it would then take $O(nk\log k)$ time to make the suffix tree.

Any clarity or help on this would be much appreciated!

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
Recessive
  • 143
  • 5

0 Answers0