@Jalaj. The original poster said, "P.S---do not give block reversal method for array rotation ...."
Dave On Jul 2, 10:54 am, jalaj jaiswal <[email protected]> wrote: > reverse full array first > then, reverse last k elemnts and initial n-k elements seperately > this will do > On Fri, Jul 2, 2010 at 8:34 PM, Ratnesh Thakur > <[email protected]>wrote: > > > > > > > correction.. > > a[j]=a[j-1] instead of a[i]=a[i-1] > > > On Fri, Jul 2, 2010 at 7:30 PM, Ratnesh Thakur > > <[email protected]>wrote: > > >> i think this should work. > > >> for(i=1;i<=k;i++) > >> { > >> var=a[n-1] > >> for(j=n-1;j>=1;j--) > >> a[i]=a[i-1] > >> a[0]=var > > >> } > > >> On Fri, Jul 2, 2010 at 5:36 PM, Saurabh Ahuja > >> <[email protected]>wrote: > > >>> a[0] = a[2] > >>> a[1] = a[3] > >>> a[2] = a[4] > > >>> a[0] and a[1] has been changed > >>> a[3] = a[0] > >>> a[4] = a[1] > > >>> so this solution would not work. > > >>> On Fri, Jul 2, 2010 at 5:14 PM, Akash Gangil <[email protected]>wrote: > > >>>> wouldn't this work: > > >>>> for i in range(0,len) > >>>> a[i] = a[(i+2)%5]; > > >>>> where len is the length of array > > >>>> On Sat, Jun 26, 2010 at 3:37 PM, sharad kumar <[email protected] > >>>> > wrote: > > >>>>> i have to right rotate an array by k positions > >>>>> 1 2 3 4 5 for k=2 o/p shud be > >>>>> 3 4 5 1 2 > > >>>>> P.S---do not give block reversal method for array rotation and soln > >>>>> must be inplace.....plzz write ur logic also along with d code > > >>>>> -- > >>>>> 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]<algogeeks%2bunsubscr...@googlegroups.com> > >>>>> . > >>>>> For more options, visit this group at > >>>>>http://groups.google.com/group/algogeeks?hl=en. > > >>>> -- > >>>> Best Regards > >>>> Akash Gangil > > >>>> -- > >>>> 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]<algogeeks%2bunsubscr...@googlegroups.com> > >>>> . > >>>> 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]<algogeeks%2bunsubscr...@googlegroups.com> > >>> . > >>> 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]<algogeeks%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > With Regards, > Jalaj Jaiswal > +919026283397 > B.TECH IT > IIIT ALLAHABAD- Hide quoted text - > > - Show quoted text - -- 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.
