On Wed, Jun 22, 2011 at 8:20 PM, Navneet Gupta <navneetn...@gmail.com>wrote:
> Let the array elements be 2,3,5,10 & 1,4,8,12. > > Have two index variables m and n. Intially m will point to 2 and n to 1. > > 1. Compare the elements in m and n. > 2. If elem[m] > elem[n] swap, increment n > *I think it should be increment m. * > ** 3. else increment m and go to step 1* /* Decrement here */*. > 4. end if m becomes the starting value of n or n reaches end of array. > > Think it should work. > > On Wed, Jun 22, 2011 at 4:05 PM, Algoose chase <harishp...@gmail.com> > wrote: > > Reverse the 2nd part of the Array so that they are sorted in descending > > order. > > Then apply bitonic sort > > On Wed, Jun 22, 2011 at 2:34 PM, ross <jagadish1...@gmail.com> wrote: > >> > >> @himanshu: I dont think, the approach works, in present form. > >> in place merge sort or insertion sort is fine. > >> Test with, 12 13 19 16 and 0 20 10 14 as 2 parts of the array. > >> > >> On Jun 22, 8:42 am, Sriganesh Krishnan <2448...@gmail.com> wrote: > >> > ya...we can do it in O(n) n time!!! > >> > nice question! > >> > > >> > On Tue, Jun 21, 2011 at 11:01 PM, himanshu kansal < > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > himanshukansal...@gmail.com> wrote: > >> > > @anika: yar merge sort vl tk nlogn time....instead u cn do dt > maintain > >> > > two > >> > > ptrs one at the beginning and one intitially pointing to middle of > the > >> > > array... > >> > > thn compare the elemnts pointed by them and swap the values if > >> > > necesary nd > >> > > incremnt d ptr as u go on... > >> > > ths vl tk (n/2)+(n/2)-1 =O(n) time.... > >> > > corrct me if m wrong.... > >> > > >> > > On Tue, Jun 21, 2011 at 10:56 PM, Anika Jain > >> > > <anika.jai...@gmail.com>wrote: > >> > > >> > >> its like inplace mergesort > >> > > >> > >> On Tue, Jun 21, 2011 at 10:13 PM, aanchal goyal > >> > >> <goyal.aanch...@gmail.com > >> > >> > wrote: > >> > > >> > >>> you have an array of size n where first n/2 is sorted and the > >> > >>> sencond > >> > >>> half is sorted . You need to sort the entire array inplace > >> > >>> Its second modification version is where first part is sorted and > >> > >>> other > >> > >>> is NOT sorted . You need to make entire sorted . > >> > > >> > >>> -- > >> > >>> Regards,* > >> > >>> Aanchal Goyal*. > >> > > >> > >>> -- > >> > >>> 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. > >> > > >> > > -- > >> > > >> > > Regards > >> > > Himanshu Kansal > >> > > Msc Comp. sc. > >> > > (University of Delhi) > >> > > >> > > -- > >> > > 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. > >> > > > > -- > > 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. > > > > > > -- > --Navneet > > -- > 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.