@shady.. Correction.. palindromes are not always of even length..
For ex- abcdcba is a palindrome and not of even length... On 30 Dec, 22:14, shady <sinv...@gmail.com> wrote: > ya, you are right... > btw, palindromes are always of even length so basically it is like finding > the maximum length palindrome from a string such that it is a > substring(continuous in nature) > > On Fri, Dec 30, 2011 at 10:15 PM, atul anand <atul.87fri...@gmail.com>wrote: > > > > > > > > > @shady :- > > > correction:- > > input output > > aaggaa aaggaa > > > On Fri, Dec 30, 2011 at 9:57 PM, shady <sinv...@gmail.com> wrote: > > >> lucifier question is to find an even length substring which is a > >> palindrome, and your algorithm is correct, i didn't go into implementation > >> details > > >> input output > >> aaaa aaaa > >> aabbaa aabbaa > >> aaaggaaa aaaggaaa > >> aaggaa agga > > >> On Fri, Dec 30, 2011 at 9:51 PM, Lucifer <sourabhd2...@gmail.com> wrote: > > >>> @atul.. > > >>> R u trying. to find the longest even palindrome or just an even > >>> palindrome ? > > >>> If ur looking for the longest even palindrome then it be bbbb and the > >>> size returned would be 4. > > >>> If ur looking for just an even palindrome and want break out as per my > >>> comments given then it will be "bb" and size would be 2. > > >>> I just traced it and it looks fine.. > > >>> Also looking at ur example and assuming that ur just trying to find an > >>> even palindrome and longest one then i see that the breaking out of > >>> the loop is correct and the size is 2 with the string being "bb".. > > >>> Hence, can u be more specific... > > >>> On 30 Dec, 21:10, Lucifer <sourabhd2...@gmail.com> wrote: > >>> > @atul, > >>> > I don't have a break condition.. > >>> > Can u be more specific.. > > >>> > On 30 Dec, 21:07, atul anand <atul.87fri...@gmail.com> wrote: > > >>> > > @Lucifier : > > >>> > > your 1st approach fails for the following cases:- > > >>> > > *aaaa* > >>> > > *aa*bb*aa* > >>> > > *aaa*gg*aaa* > > >>> > > etc.... > > >>> > > basically for cases where the 1st two and last two character of the > >>> even > >>> > > palindrome are same. > > >>> > > for eg:- > > >>> > > 1 2 3 4 > >>> > > ---------- > >>> > > b b b b > > >>> > > 1st iteration :- > > >>> > > X = 1 1 1 1 > > >>> > > 2nd iteration :- > > >>> > > X= 1 1 1 2 > > >>> > > (pStrt - X[pStrt] + 1 == pRev) -> *3=4-2+1* this condition will > >>> satisfy > >>> > > and loop will break. > > >>> > > On Fri, Dec 30, 2011 at 9:02 PM, atul anand <atul.87fri...@gmail.com> > >>> wrote: > >>> > > > @praveen : question is to find longest even length pallindrome. > > >>> > > > there was some misunderstanding earlier. > > >>> > > > so if input is aaaa > >>> > > > output string is = aaaa > > >>> > > > check lucifier post above. > > >>> > > > we discussed another question in the same post bcoz > >>> > > > of initial misunderstanding :- > > >>> > > > Q) Given a string of length N, find whether there exits an even > >>> length > >>> > > > reverse substring of a substring. > > >>> > > > you can see mine or lucifier algo for this question. > > >>> > > > On Fri, Dec 30, 2011 at 8:23 PM, praveen raj < > >>> praveen0...@gmail.com>wrote: > > >>> > > >> The Question is: whther there exist a even length pallindrome or > >>> not.... > > >>> > > >> since for even ... the two consecutive character will be equal... > > >>> > > >> so find two character which are equal.. consecutively...... > > >>> > > >> PRAVEEN RAJ > >>> > > >> DELHI COLLEGE OF ENGINEERING > > >>> > > >> -- > >>> > > >> You received this message because you are subscribed to the > >>> Google Groups > >>> > > >> "Algorithm Geeks" group. > >>> > > >> To post to this group, send email to algogeeks@googlegroups.com. > >>> > > >> To unsubscribe from this group, send email to > >>> > > >> algogeeks+unsubscr...@googlegroups.com. > >>> > > >> For more options, visit this group at > >>> > > >>http://groups.google.com/group/algogeeks?hl=en. > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Algorithm Geeks" group. > >>> To post to this group, send email to algogeeks@googlegroups.com. > >>> To unsubscribe from this group, send email to > >>> algogeeks+unsubscr...@googlegroups.com. > >>> For more options, visit this group at > >>>http://groups.google.com/group/algogeeks?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to algogeeks@googlegroups.com. > >> To unsubscribe from this group, send email to > >> algogeeks+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/algogeeks?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.