how abt two passes

first one makes a multi map of char and its positions
second one a bit tricky to


eg



abcabcabc


first pass

a,0,3,6,
b,1,4,7
c,2,5,8


second pass


first char is a, its next position is 3(find thrugh the map)
repeated substring can be of length 3

for loop with this (count-1)
if three char matchs, mean repeat, otherwise move to next position eg 6 in
this case for a and compare str[1] to str[6] for next 6-0-1 chars and see if
6 chars match this way and so on... if no repeat is found this way, move to
next char in the string i.e. str[1] in this case..


Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Wed, Jun 29, 2011 at 11:10 PM, Piyush Sinha <[email protected]>wrote:

> jokes apart...then i think it can be done using dynamic programming
> using the similar approach of LCS but the time and space complexity
> both will be N^2.....i am working on the pseudocode and post it within
> a few moments if it works..
>
> On 6/29/11, Swathi <[email protected]> wrote:
> > I dont know why people reply in plain words.. I personally had this
> > experience and i was asked to code but i couldn't
> >
> > On Wed, Jun 29, 2011 at 10:53 PM, Piyush Sinha
> > <[email protected]>wrote:
> >
> >> I dnt think any company is gonna ask u to code suffix tree..:P :P
> >>
> >> On 6/29/11, Swathi <[email protected]> wrote:
> >> > It does but i am asked to code.. if you know the code for suffix tree
> >> then
> >> > please provide..
> >> >
> >> > On Wed, Jun 29, 2011 at 10:30 PM, Piyush Sinha
> >> > <[email protected]>wrote:
> >> >
> >> >> i think suffix tres will do the job if i have not misunderstood the
> >> >> question...
> >> >>
> >> >> On 6/29/11, Swathi <[email protected]> wrote:
> >> >> > Given a string (assume there no spaces or punctuations), write a
> code
> >> >> that
> >> >> > returns the max. length of the string that has repeated more than
> >> once.
> >> >> >
> >> >> > Thanks,
> >> >> > Swathi
> >> >> >
> >> >> > --
> >> >> > 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.
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> *Piyush Sinha*
> >> >> *IIIT, Allahabad*
> >> >> *+91-8792136657*
> >> >> *+91-7483122727*
> >> >> *https://www.facebook.com/profile.php?id=100000655377926 *
> >> >>
> >> >> --
> >> >> 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.
> >> >>
> >> >>
> >> >
> >> > --
> >> > 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.
> >> >
> >> >
> >>
> >>
> >> --
> >> *Piyush Sinha*
> >> *IIIT, Allahabad*
> >> *+91-8792136657*
> >> *+91-7483122727*
> >> *https://www.facebook.com/profile.php?id=100000655377926 *
> >>
> >> --
> >> 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.
> >>
> >>
> >
> > --
> > 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.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=100000655377926 *
>
> --
> 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.
>
>

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

Reply via email to