@sumit How do u guarantee O(N) in.. T(n) = T(n/2) + O(n).. I don't think just searching from the middle would cover all the cases...
Say u have array of size 20 partitioned in 2 subarrays of sizes 10 and 10.. Now from left subarray u have a plaindrome of some recorded length.. Similarly from the right. And you are doing is taking the palindrome which is centered at the middle of the main array and comparing them with left and right. I think this is incorrect as say ur actual palindrome is centered at index 8 and is of size 14. Now can u explain me how would u get this no. 14 based on the nlogn approach.. On Dec 29, 1:44 pm, shady <[email protected]> wrote: > given question is :- > > Given a string of length N, find whether there exits an even length > palindrome substring. > > question is unclear, you want a palindrome whose substring of even length > is present in the given string of length N, right ? where the palindrome is > itself formed from the given string. > so for > > str = abcdtrwdcba > answers can be many, there is no restriction that palindrome itself has to > be of even length, so if palindrome from above string is *abcdrdcba, *then > substrings of even length present in str are *abcd, dcba.* > * > * > str = abcdtrwdcba > answers can be many, there is no restriction that palindrome itself has to > be of even length, so if palindrome from above string is *abcdtdcba, *then > substrings of even length present in str are *abcd, bcdt, dcba.* > * > * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
