@Juver - I am getting Access denied for the pdf link you sent :( On Jun 27, 8:48 am, "juver++" <avpostni...@gmail.com> wrote: > Here it is:http://arxiv.org/PS_cache/arxiv/pdf/0805/0805.1598v1.pdf > > On Jun 27, 5:02 am, Ankit Sablok <ankitsablok19091...@gmail.com> > wrote: > > > Need a Better Algorithm > > > here is a trivial question we are given an array of 2n elements in the > > form > > {a1,a2,a3,......,an,b1,b2,b3b.......bn} > > > we need to output a resultiing array in the form > > {a1,b1,a2,b2........,an,bn} > > but without using another array here is my algorithm which uses nested > > loops can anyone provide a better solution which doesnt involve > > shifting. > > > int i,j,k,temp; > > j=num; > > > int Interleave(int *arr) > > { > > > for(i=1;i<2*num - 1;i+=2) > > { > > temp = arr[j]; > > > for(k=j;k>=i+1;--k) > > arr[k]=arr[k-1]; > > > arr[i] = temp; > > ++j; > > } > > > }
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.