Re: [algogeeks] Find even length palindrome.

2011-12-28 Thread Ashish Goel
http://www.allisons.org/ll/AlgDS/Tree/Suffix/#demoForm Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Dec 28, 2011 at 11:27 AM, sumit mahamuni sumit143smail...@gmail.com wrote: Slow code that scales better can be faster than fast code

Re: [algogeeks] Find even length palindrome.

2011-12-28 Thread atul anand
@sumit : whats your nlogn approach ??? On Wed, Dec 28, 2011 at 11:27 AM, sumit mahamuni sumit143smail...@gmail.com wrote: Here I can think of O( n * log n ). can anyone think of better solution?? On Tue, Dec 27, 2011 at 11:06 PM, atul007 atul.87fri...@gmail.com wrote: Given a string of

Re: [algogeeks] Find even length palindrome.

2011-12-28 Thread raj
@atul I am not sure whether I got ur question correctly.If you only want to check whether an even palindrome exist or not,then u can check for whether adjacent characters are same or not.It is very simple.If you want the longest string then its gets difficult.Same algo can be also used for

Re: [algogeeks] Find even length palindrome.

2011-12-28 Thread raj
@atul If we need to find the longest palindrome whether even or odd we can use DP.The recursion can look this: LP(i,j) = max( LP(i+1,j),LP(i,j-1) if(string[i]!=string[j]) max( LP(i+1,j),LP(i,j-1),LP(i+1,j-1)+1 ) else Note : Do

[algogeeks] Find even length palindrome.

2011-12-27 Thread atul007
Given a string of length N, find whether there exits an even length palindrome substring. what would be efficient way of solving this problem.? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Find even length palindrome.

2011-12-27 Thread atul anand
one solution could be :- hash every even number substring , starting from beginning. after this. hash every even number substring , starting from end. if it exists..means palindrome exists. complexity would be O(N^2). On Tue, Dec 27, 2011 at 11:06 PM, atul007 atul.87fri...@gmail.com wrote:

Re: [algogeeks] Find even length palindrome.

2011-12-27 Thread sumit mahamuni
Here I can think of O( n * log n ). can anyone think of better solution?? On Tue, Dec 27, 2011 at 11:06 PM, atul007 atul.87fri...@gmail.com wrote: Given a string of length N, find whether there exits an even length palindrome substring. what would be efficient way of solving this problem.?