[algogeeks] Re: longest repeated substring

2011-08-19 Thread WgpShashank
Hi Mac, Problem Have Discussed Several Time across various forums ,here one of the possible solution using Suffix Array in O(N^2) http://shashank7s.blogspot.com/2011/06/longest-repeated-substring-eg-maximum.html Hope it will be helpful, let me know for if any test case its not working or any

Re: [algogeeks] Re: longest repeated substring

2011-08-19 Thread Reynald Suz
Thanks for your blog post, *Shashank Mani * :) On Fri, Aug 19, 2011 at 2:42 PM, WgpShashank shashank7andr...@gmail.comwrote: Hi Mac, Problem Have Discussed Several Time across various forums ,here one of the possible solution using Suffix Array in O(N^2)

[algogeeks] Re: longest repeated substring

2011-08-18 Thread DheerajSharma
O(n^2) i guess.. We can save all possible substrings..(in two loops it can be done) in a hash map..as key..and the value as COUNT..then we can..search for the most occurring substring!! u said for non - efficient ;) On Aug 18, 6:07 pm, MAC macatad...@gmail.com wrote: A string can have many

[algogeeks] Re: longest repeated substring

2011-08-18 Thread DheerajSharma
suffix tree is obvsly best..but hard to code at interview!! On Aug 18, 7:20 pm, DheerajSharma dheerajsharma1...@gmail.com wrote: O(n^2) i guess.. We can save all possible substrings..(in two loops it can be done) in a hash map..as key..and the value as COUNT..then we can..search for the most

Re: [algogeeks] Re: longest repeated substring

2011-08-18 Thread Arun Vishwanathan
am just asking but how can u get all possible substrings in O(n square) time when there are 2 power N of them actually? On Thu, Aug 18, 2011 at 4:20 PM, DheerajSharma dheerajsharma1...@gmail.comwrote: O(n^2) i guess.. We can save all possible substrings..(in two loops it can be done) in a

Re: [algogeeks] Re: longest repeated substring

2011-08-18 Thread saurabh singh
substrings and subsets are two different things. If you want an easy solution brute force it...:) Its not that difficult to code a suffix tree if it makes you a millionare:) On Thu, Aug 18, 2011 at 7:59 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote: am just asking but how can u get