|
-
April 12th, 2011, 12:03 PM
#1
Longest Palindrome in String
I am looking for O(N) solution to the problem of finding longest palindrome in a string
in linear time-complexity...
I got a link in which this problem is described....but i m not able to understood it clearly
(how it reduces from O(N^2) to O(N) complexity...)
Link: http://www.akalin.cx/2007/11/28/find...n-linear-time/
I am very confused with "what is the palindromic proper suffix and how we find it out"
also how "given a current center, the longest palindrome around that center, and a list of the lengths of the longest palindromes around the centers to the left of the current center, can we figure out the new center to consider and extend the list of longest palindrome lengths up to that center efficiently?"
Please, reply.
PS: Please ignore the suffix tree approach
-
April 21st, 2011, 01:57 PM
#2
Re: Longest Palindrome in String
You problem is supposed to be another form of longest common substring, which the suffix tree seems best fitted in terms of time complexity, with only trade-off for space and extra steps in tree building. The current O(n^2) looks founded and widely used until some striking alternative approach hits the journal in the very near future, I hope.
-
May 15th, 2011, 12:14 PM
#3
Re: Longest Palindrome in String
Hi, I found this link
http://portal.acm.org/citation.cfm?id=1840177
it is computeing longest palindrome in linear time and space.
But it asks me to pay. Anyone knows its content, pseudoalgorithm to do that ?
-
May 16th, 2011, 01:00 AM
#4
Re: Longest Palindrome in String
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
May 17th, 2011, 01:37 PM
#5
Re: Longest Palindrome in String
They provided translated code that works incorrectly,
For this string
dcfcdhihijkjihjfccccccccccabcdefggfedcba
the last C++ source code returns cccccccccc, I think this is the purpose of the program, as the second loop only counts indices in case of equal characters encountered to retrieve its length, there is no check for palindromes. that is why it takes O(n). (Just my brief reading)
-
May 17th, 2011, 01:47 PM
#6
Re: Longest Palindrome in String
Well the last source code is written in C#,
hi,,,
-
May 18th, 2011, 09:50 PM
#7
Re: Longest Palindrome in String
Oh, sorry; I wasn't reading carefully. I read your main post a few days ago and neglected to see that you included the same link I gave you. >__<
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|