This is a simple merge, so what is the trick? Did you forget something? On Mon, Aug 1, 2011 at 3:19 PM, Gary Drocella <gdroc...@gmail.com> wrote: > Here is O(n) alg... > Does Waste Memory Though :) just don't have an array over 4G, and you > should be good. > > proc Merge_Partition(A) > > B = {}; > index = 0; > count0 = 0; > count1 = (n/2); > > while index to A.length > B[index++] = A[count0++]; > B[index++] = A[count1++]; > end while > > return B > > end proc > > On Aug 1, 1:30 pm, Manmeet Singh <mans.aus...@gmail.com> wrote: >> Your code does not works proper;y for all cases >> >> >> >> >> >> >> >> On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan <jalanha...@gmail.com> wrote: >> > Here is the recursive algo: >> >> > Rearrange(A,p,q) >> > 1. if p is not equal to q do the following >> > 2. r ← (p+q)/2 >> > 3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2]. >> > 4. Rearrange(A,p,r) >> > 5. Rearrange(A,r+1,q) >> > 6. return >> >> > On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta >> > <gupta.abh...@gmail.com>wrote: >> >> >> A is an array of size 2n such that first n elements are integers in any >> >> order and last n elements are characters. >> >> i.e. A={i1 i2 i3 ....in c1 c2 c3... cn} >> >> then we have to rearrange the elements such that final array is >> >> A ={ i1 c1 i2 c2 ...... in cn} >> >> >> Example : >> >> input : A ={ 5,1,4,d,r,a}; >> >> output : A= {5,d,1,r,4,a}; >> >> >> -- >> >> Abhishek Gupta >> >> MCA >> >> NIT Calicut >> >> Kerela >> >> >> -- >> >> 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. >> >> > -- >> > Regards : >> > ROHIT JALAN >> > B.E. Graduate, >> > Computer Science Department, >> > RVCE, Bangalore >> >> > -- >> > 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. > >
-- ------------------------------------------------------------------- Douglas Gameiro Diniz Engenheiro de Computação - 2003 - UNICAMP Mobile: (19) 92158777 Gtalk: dgdiniz Msn: thedougdi...@hotmail.com -- 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.