@Ankit, The input should be 2 sorted arrays

Thanks,
Immanuel

On Sun, May 29, 2011 at 10:48 AM, ankit sambyal <ankitsamb...@gmail.com>wrote:

> @sravanreddy: it won't work.   Try 3,91,9   and   90,1,8,2,5   .  correct
> me if i m wrong.
>
> Thanks,
> Ankit Sambyal
>
> On Sat, May 28, 2011 at 9:16 PM, ross <jagadish1...@gmail.com> wrote:
>
>> @sravanreddy:
>> Hey, Nice Solution :) cool!
>>
>> On May 29, 7:44 am, sravanreddy001 <sravanreddy...@gmail.com> wrote:
>> > Maintain a pointer A_end = m-1;
>> > doing a comparision something similar to merge sort
>> >
>> > int i=0;j=0;
>> > while (i< m){
>> >  if (a[i] < b[j])
>> >   i++;
>> >  else{
>> >   swap(a[A_end],b[j])
>> >   A_end --;
>> >   j++;
>> >  }
>> >
>> > }
>> >
>> > This runs in O(m) time and no extra space, also the sort order is not
>> > guarenteed.
>>
>> --
>> 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.

Reply via email to