i guess dis shud wrk...
void merge(int arr[],int i,int k)
{
if(i==1)
{
arr[1]=arr[k];
arr[2]=arr[2*k];
return;
}
int a=arr[i-1];
int b=arr[2*i-1];
int c=arr[3*i-1];
merge(arr,i-1,n-3);
int t=(k-3);
arr[t]=a;
arr[t+1]=b;
arr[t+2]=c;
}

On Mon, Aug 6, 2012 at 1:05 AM, adarsh kumar <[email protected]> wrote:

> Cos, if they are stored as a vector of strings like a1, b1, etc. then u
> can use insertion sort like technique.
> Insert bi and ci between ai and a(i+1), for i=1,2,3....n.
> This can be done simply by modifyin insertion  sort code. Pl let me know
> in case of any flaw! cos it seems to be so simple this way.
>
> On Mon, Aug 6, 2012 at 1:02 AM, adarsh kumar <[email protected]> wrote:
>
>> vector*
>>
>>
>> On Mon, Aug 6, 2012 at 1:02 AM, adarsh kumar <[email protected]> wrote:
>>
>>>
>>> Can you care to explain as to how exactly the elements are stored? Is it
>>> a vactor of strings??
>>>
>>> On Mon, Aug 6, 2012 at 12:32 AM, Navin Kumar 
>>> <[email protected]>wrote:
>>>
>>>> Actually i wanted to do it inplace. Using extra space it is much
>>>> easier problem.
>>>>
>>>>
>>>> On Mon, Aug 6, 2012 at 12:27 AM, payal gupta <[email protected]>wrote:
>>>>
>>>>> int merge(int arr[],int n)
>>>>> {
>>>>> int l=0;
>>>>> int j=(n/3);
>>>>> int k=2*(n/3);
>>>>> int *a=(int*)malloc(sizeof(int)*n);
>>>>> for(int i=0;i<n/3;i++)
>>>>> {
>>>>> a[l++]=arr[i];
>>>>> a[l++]=arr[j++];
>>>>> a[l++]=arr[k++];
>>>>> }
>>>>> for(int i=0;i<n;i++)
>>>>> arr[i]=a[i];
>>>>> free(a);
>>>>> }
>>>>> cud be dun be dun recursively also to minimize d space complexity...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Aug 4, 2012 at 8:20 AM, Navin Kumar 
>>>>> <[email protected]>wrote:
>>>>>
>>>>>> In given array of elements like 
>>>>>> [a1,a2,a3,..an,b1,b2,b3,..bn,c**1,c2,c3,...cn]
>>>>>> .Write an efficient program to merge them like
>>>>>> [a1,b1,c1,a2,b2,c2,...an,bn,cn**].
>>>>>>
>>>>>> --
>>>>>> 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/-/gVCyxQV1IhAJ.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected].
>>>>>> 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 [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> 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 [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to