unique substrings using suffix tree
Posted
by
user1708762
on Stack Overflow
See other posts from Stack Overflow
or by user1708762
Published on 2012-10-12T12:59:37Z
Indexed on
2012/10/20
5:03 UTC
Read the original article
Hit count: 123
For a given string S
of length n
-
Optimal algorithm for finding all unique substrings of
S
can't be less thanO(n^2)
. So, the best algorithm will give us the complexity ofO(n^2)
. As per what I have read, this can be implemented by creating suffix tree forS
.
The suffix tree for S can be created in O(n)
time. Now, my question is-
How can we use the suffix tree for S to get all the unique substrings of S
in O(n^2)
?
© Stack Overflow or respective owner