Re: [algogeeks] cyclic String

2010-09-13 Thread Raj N
Concatenate the string to itself and if the given string is a substring of the new concatenated string then it is a cyclic string On Sat, Sep 11, 2010 at 3:38 PM, Ashim Kapoor wrote: > I can do it in 2 O(n)sweeps if all elements are distinct. > 12345 > 23451 > > Sweep one to find the 1st element

Re: [algogeeks] cyclic String

2010-09-11 Thread Ashim Kapoor
I can do it in 2 O(n)sweeps if all elements are distinct. 12345 23451 Sweep one to find the 1st element of string 1 in string 2. Sweep 2 to compare each element of the 2 strings from the position mod n found in the 1st sweep. I dont know how to do it if elements are repeated. but the way Praveen

Re: [algogeeks] cyclic String

2010-09-11 Thread Praveen Baskar
str="hello"; str1="lloeh"; if (str+str).subString(str1) is true then the string is cyclic string of another On Sat, Sep 11, 2010 at 1:52 PM, bittu wrote: > How will you check if a string is cyclic string of another > > solution O(n)..???/?? or even less compraiosn.. > > -- > You received thi

[algogeeks] cyclic String

2010-09-11 Thread bittu
How will you check if a string is cyclic string of another solution O(n)..???/?? or even less compraiosn.. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe fr