for the given string even lenght palindrome found is *abcd* not *abcddcba*
string = *abcd*trw*dcba*

how's it abcddcba??

On Thu, Dec 29, 2011 at 10:08 AM, Lucifer <sourabhd2...@gmail.com> wrote:

> @atul
> The example that u have taken, is it correct ?
> I see that in the search string 'abcdtrwdcba' acc to u the even length
> palindrome is abcddcba..
>
> On Dec 29, 9:23 am, atul anand <atul.87fri...@gmail.com> wrote:
> > @Lucifier :
> >
> > this is wat i was trying to say :-
> >
> > string = abcdtrwdcba
> >
> > find even length substring and hash them , moving from left to right.
> >
> > hash(abcdtrwdcba) // corner case
> > hash(ab)
> > hash(abcd)
> > hash(abcdtr)
> > .
> > .
> > .
> > hash(dcba).
> >
> > after hashing is done.
> >
> > again hash moving from right to left.
> > hash(abcd) ---> hash alreday present so ...even length palindrome exists.
> > you need to take care of cases like for ab ->hash is present , but is
> part
> > of bigger substring (abcd) when moving from right to left. so keep track
> of
> > the index.
> > here how to keep track:-
> >
> > when you find hash of (ab) index=i;
> > when you find second even palindrome hash(abcd).
> >
> > if length("abcd") > length("ab");
> > {
> >         temp_index=current_index + lenght("ab");
> >         if(temp_index== index)
> >         {
> >                     // we know ab is the  part of bigger string
> abcd.update
> > the new even palindrome found.
> >         }
> >
> >
> >
> >
> >
> >
> >
> > }
>
> --
> 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.

Reply via email to