right.. To do it in O(n) we will need O(n) extra space. and without extra space we can use a divide and conquer approach with O(lgn) stack space
On Fri, Jul 22, 2011 at 12:04 PM, saurabh singh <saurab...@gmail.com> wrote: > The approach by atul is maintaining partitions of array such that element > left to it are even and right odd.Its an implementation of quick sort as > discussed earlier.Its o(n) no doubt but its not stable. > > On Fri, Jul 22, 2011 at 11:51 AM, sunny agrawal > <sunny816.i...@gmail.com>wrote: > >> @atul >> Your algo is not stable >> http://www.ideone.com/DrV5J >> >> BTW what are u trying to do >> instead of posting a code please prefer posting a simple algorithm in text >> >> coding part is very easy once the correct algorithm is found >> >> >> On Fri, Jul 22, 2011 at 11:43 AM, Puneet Gautam >> <puneet.nsi...@gmail.com>wrote: >> >>> @atul: can u pls tell me how did u go about solving this in ur mind..? >>> >>> >>> On 7/22/11, Abhi <abhi123khat...@gmail.com> wrote: >>> > @atul: can you please elaborate the algorithm you are using. >>> > >>> > -- >>> > You received this message because you are subscribed to the Google >>> Groups >>> > "Algorithm Geeks" group. >>> > To view this discussion on the web visit >>> > https://groups.google.com/d/msg/algogeeks/-/mLtfUz77JMIJ. >>> > 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 IV 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. >> > > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > -- > 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 IV 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.