i guess this algo would work...
1.scan the two array "a" and "b" from the end
say the indexs be i & j respectively for the two arrays
2.compare the elements a[i]  with b[j]
 if a[i]<b[j]
include  b[j] & j--
else if a[i]>b[j]
      then include a[i] & j--
      else if recursively findin reducing which index would serve better
     {
      consider the case   a[]={1,2,3,3,3,4} ,b[]={3,3,3,6,7,8 };
     when coming to index i=4  and j=2 educing j is beneficial
    }
iterate through step 2 until one of the array ends.and then include the
remaining elements of the other non empty array





On Fri, Jul 13, 2012 at 1:35 AM, sumit991 <sumitphulkan...@gmail.com> wrote:

> how would you solve it then
>
> On Wednesday, July 11, 2012 2:53:26 AM UTC+5:30, Mr.B wrote:
>
>> I think you missed the question:
>> Its a stable merge. (order of elements in each array should be same)
>> Sorting will destroy the original order.
>>
>> Thanks,
>> Mr.B
>> [Please include complexities and pseudo-code]
>>
>> On Tuesday, 10 July 2012 16:18:04 UTC-4, Akshat wrote:
>>>
>>> Here you have to first sort both the arrays A and B and merge both the
>>> arrays to form the sorted array C
>>>
>>> --
>>>
>>>
>>> Akshat Sapra
>>> Under Graduation(B.Tech)
>>> IIIT-Allahabad(Amethi Campus)
>>> *--------------------------------------*
>>> sapraaks...@gmail.com
>>> akshatsapr...@gmail.com
>>> rit20009008@ <rit20009...@gmail.com>iiita.ac.in
>>>
>>  --
> 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/-/mBt7Y0hzUL0J.
>
> 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