oh sorry for above soln...it will require many passes and hence inefficient...
On Fri, Jul 22, 2011 at 9:02 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.
