Its Out Shuffle not In shuffle, although both are similar and you can read both
On Fri, Oct 14, 2011 at 8:26 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > this problem is like Card shuffling problem(search for In-shuffle) > i think solution is > if indexing is zero based > each i will go to -> k*i % (N-1) > k = 3 and N = 3*n -1 > n = no of cards in one pile Or No of a's > > > On Fri, Oct 14, 2011 at 7:52 PM, shiva@Algo <shiv.jays...@gmail.com>wrote: > >> @Gaurav how will u do for >> a1a2a3a4a5b1b2b3b4b5c1c2c3c4c5 >> >> >> On Fri, Oct 14, 2011 at 6:49 AM, gaurav yadav >> <gauravyadav1...@gmail.com>wrote: >> >>> consider following example... >>> suppose initailly we have a1a2a3b1b2b3c1c2c3 >>> >>> then do the following-> >>> a1a2a3 b1b2b3 c1c2c3 (look for b1 in the remaining array and swap with >>> a2 , so in this case swap(a2,b1) ) >>> a1b1a3 a2b2b3 c1c2c3 (similarly swap(a3,c1) ) >>> a1b1c1 a2b2b3 a3c2c3 swap(b3,c2) >>> a1b1c1 a2b2c2 a3b2c3 >>> >>> >>> this in inplace >>> >>> (plz correct if im wrong) >>> >>> -- >>> 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. >>> >> >> -- >> 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. >> > > > > -- > Sunny Aggrawal > B.Tech. V year,CSI > Indian Institute Of Technology,Roorkee > > -- Sunny Aggrawal B.Tech. V year,CSI Indian Institute Of Technology,Roorkee -- 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.