I read somewhere that you can find the longest repeating substring of a given string by finding the deepest internal node of the suffix tree. Though that makes sense, how can you prove that this process is only O(n).
Or more specifically, in this process all the nodes are visited. I dont see it straightforward that the number of nodes in the suffix tree will be O(n). How is it O(n)?