mutux / Ukkonen-s-Suffix-Tree-Algorithm

Ukkonen's suffix tree algorithm, a complete version implemented in Python
http://mutux.com
MIT License
25 stars 10 forks source link

O(n^2) time complexity due to list copy #5

Open IgSaf opened 3 years ago

IgSaf commented 3 years ago

There is a copy of list in unfold function. It leads to O(len(remains)) time complexity for this operation. And due to being inside while remainder > 0 this gains O(n^2) time complexity for the whole implementation (e.g. for "aaaaab").