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.