oh yeah..sorry ;) n thanks for the solution :) On Sat, Aug 27, 2011 at 11:26 AM, Sanjay Rajpal <[email protected]> wrote:
> u have mentioned clockwise, but o/p u r giving is anti-clock wise. > > solution for clockwise : > > See Reverse last k and first n-k numbers e.g. > 5 4 3 2 1 8 7 6 > > now reverse whole array. > 6 7 8 1 2 3 4 5. > > solution for anti-clockwise : > See Reverse first k and last n-k numbers e.g. > 3 2 1 8 7 6 5 4 > > now reverse whole array. > > 4 5 6 7 8 1 2 3 > > Hope u got it. > > Sanju > :) > > > > On Fri, Aug 26, 2011 at 10:49 PM, Dheeraj Sharma < > [email protected]> wrote: > >> How to rotate 1d array of length clockwise 'k' times?? >> (1,2,3,4,5,6,7,8)->(4,5,6,7,8,1,2,3) for k=3 n= 8 >> >> Give solutions which do not swap the array k times!! i.e less than O(nk) >> >> -- >> *Dheeraj Sharma* >> Comp Engg. >> NIT Kurukshetra >> +91 8950264227 >> >> -- >> 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. > -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- 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.
