suffix tree construction in O(n)