[algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread T3rminal
@Akshay Suffix tree construction is O(n) On Jun 14, 8:58 pm, Akshay Rastogi akr...@gmail.com wrote: But generating a suffix tree itself is O(n2) . On Tue, Jun 14, 2011 at 7:54 PM, sunny agrawal sunny816.i...@gmail.comwrote: it must be any general string Suffix tree approach seems

[algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread T3rminal
@bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a bit ? On Jun 14, 6:03 pm, bittu shashank7andr...@gmail.com wrote: I found one interesting question Given a string s , return the shortest substring that is only occurring once. Examples:

Re: [algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread Terence
Traversal the suffix tree is enough. All substrings from root to leaf (including at least 1 character of leaf node) occur only once. Choose the shortest among them. On 2011-6-15 5:28, T3rminal wrote: @bittu How can u find the shortest substring from the tree in 0(n). Can u please elaborate a

Re: [algogeeks] Re: Find shortest substring that is only occurring once. in Given String

2011-06-14 Thread Akshay Rastogi
@t3rminal: k On Wed, Jun 15, 2011 at 7:05 AM, Terence technic@gmail.com wrote: Traversal the suffix tree is enough. All substrings from root to leaf (including at least 1 character of leaf node) occur only once. Choose the shortest among them. On 2011-6-15 5:28, T3rminal wrote: