URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       techsuns
  HTML https://techsuns.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Puzzles && Algorithms
       *****************************************************
       #Post#: 64--------------------------------------------------
       Find whether one string is rotation of another
       By: kranthipls Date: August 27, 2012, 10:17 am
       ---------------------------------------------------------
       Let us assume that there exists a function issubstring() which
       tells whether one string is subset of another. Now given two
       strings s1 and s2 Tell whether s2 is a  rotation of s1 by using
       the issubstring() function only once.
       Rotation: Eg:  s1 = techsuns s2 =  hsunstec.
       s1= classic      s2 = ssiccla
       s1 = Reader    s2 = aderRe
       #Post#: 95--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: dada786 Date: November 18, 2012, 1:50 am
       ---------------------------------------------------------
       Does only once means once in the algorithm or only one execution
       #Post#: 96--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: kranthipls Date: November 18, 2012, 3:08 am
       ---------------------------------------------------------
       Both of them are same right. If it is used only once in the
       algorithm then it is used only once in the execution also. Isn't
       it?
       Anyway you need to use only once in the algorithm.........
       #Post#: 109--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: kpr29 Date: November 18, 2012, 11:29 pm
       ---------------------------------------------------------
       @Kranthi: Combine the s2 string together. For
       example............ if s2 is anthikr................ u get
       anthikranthikr............ Now call the issubstring() once and
       find out s1 is subsstring if yes s2 is rotation of s1...........
       kp
       #Post#: 112--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: kranthipls Date: November 18, 2012, 11:37 pm
       ---------------------------------------------------------
       @kpr29 You are absolutely awesome. We broke our heads two days
       to get a solution for this and finally we landed up seeing the
       solution.
       I am happy that you got it.
       #Post#: 113--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: satya Date: November 18, 2012, 11:40 pm
       ---------------------------------------------------------
       amazing one kp.........that' y u r a leader............... :P :P
       #Post#: 115--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: kpr29 Date: November 18, 2012, 11:43 pm
       ---------------------------------------------------------
       @Sattiman: Orey Manchu.............. This is an intellectual
       discussion rather "Thinking" forum............  Not ragging
       forum...............
       #Post#: 137--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: dada786 Date: November 19, 2012, 2:52 am
       ---------------------------------------------------------
       But given string is 'baba' and, to be checked stirng is 'ba', it
       does not work. I feel we should also use 'strlen'
       #Post#: 141--------------------------------------------------
       Re: Find whether one string is rotation of another
       By: kranthipls Date: November 19, 2012, 3:32 am
       ---------------------------------------------------------
       Of course that is the trivial case. If two strings lengths are
       not same then they cannot be rotation of one another. All the
       discussion is only for the strings of same length.
       *****************************************************