@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.

Reply via email to