0

A suffix tree is an efficient data structure containing all suffixes of a given string. Suffix trees support operations such as checking if a given substring exists in the string and returning all occurrences of a substring. I was wondering if it is possible to efficiently return the first occurrence in an efficient manner. By "efficient" I mean that the complexity will be equivalent to the length of the substring.

It is possible to find an occurrence of a substring by scanning the tree according to the substring, finding the index of the end of the substring appearance, e, and then returning e-len(substring) as the index of the beginning. However, I am not sure if this index is the first appearance.

Shaharg
  • 971
  • 1
  • 11
  • 26

0 Answers0