@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.

Reply via email to