Can we do this as the quick sort does in place , consider an even element as a pivot then keep two pointers ,one in beginning and other at the end and then check for even numbers if even increment i and stop on reaching an odd number now the same way with j pointer a t the end in j until even number is encountered now swap i and j and recursively do this till you get all even elements on left and odd elements on right .. What you say?? Does this logic works ??
2011/7/23 яαωαт Jee <[email protected]> > @ popli: plz change ur email id..placement session will start soon. > > On Jul 22, 8:32 pm, Gaurav Popli <[email protected]> wrote: > > an O(n) soln > > traveres the array...as you receive odd number put that index in > > queue....when received an even numb check if queue is empty or > > not...if queue is empty the do nothing else swap with the head of the > > queue.... > > > > hope it works....it also maintains the stability of aarray... > > > > > > > > > > > > > > > > On Fri, Jul 22, 2011 at 6:39 PM, Kunal Patil <[email protected]> wrote: > > > @Sunny: Excellent explanation (& solution) !! > > > > > -- > > > 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. > > -- > 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. > > -- Regards Rajeev N B <http://www.opensourcemania.co.cc> -- 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.
