Re: [algogeeks] Rotating 1D array clockwise

2011-08-26 Thread Dheeraj Sharma
oh yeah..sorry ;) n thanks for the solution :) On Sat, Aug 27, 2011 at 11:26 AM, Sanjay Rajpal 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.

Re: [algogeeks] Rotating 1D array clockwise

2011-08-26 Thread Sanjay Rajpal
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 r

[algogeeks] Rotating 1D array clockwise

2011-08-26 Thread Dheeraj Sharma
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 subscribe