Yes with my approach answer will be 0.

Please check here <http://ideone.com/Q4ivj>.

Thanks & Regards,
Anantha Krishnan

On Thu, Aug 18, 2011 at 1:33 PM, MAC <macatad...@gmail.com> wrote:

> in the example below , answer shd be 0 , . by your  apraoch this is not
> commig
>
>
> 10,25,35
>
> 10,25,30
>
> 5 ,6,25,30
>
>
>
> On Thu, Aug 18, 2011 at 1:08 PM, Anantha Krishnan <
> ananthakrishnan....@gmail.com> wrote:
>
>> If we move the maximum then difference will get larger but our aim is to
>> minimize the difference.
>>
>> Thanks & Regards,
>> Anantha Krishnan
>>
>>
>> On Thu, Aug 18, 2011 at 1:01 PM, MAC <macatad...@gmail.com> wrote:
>>
>>> as per my understanding , you are increasing the minimum value so that it
>>> reaches closer to the maximum others that we are not moving right now . Why
>>> are you not moving the maximum instead  ?
>>>
>>> basically i need the reason why you are doing so ..
>>>
>>> thanks
>>> --mac;
>>>
>>>
>>> On Thu, Aug 18, 2011 at 12:08 PM, Anantha Krishnan <
>>> ananthakrishnan....@gmail.com> wrote:
>>>
>>>> Let,
>>>>
>>>> min_dif=INT_MAX
>>>>
>>>> 1.Sort the N arrays A,B,C.....
>>>> 2.Find the minimum and maximum of A[0],B[0],C[0].....
>>>> 3.Take the difference between MAX-MIN values.
>>>> 5.If the difference is less than min_dif then update min_dif and save
>>>> all n values.
>>>> 6.Now increment the index of the array which contains minimum element.
>>>> 7.repeat these steps till end of array is reached for atleast one array.
>>>>
>>>> Please let me know if you find some difficulties with my explanation.
>>>>
>>>> Thanks & Regards,
>>>>
>>>> Anantha Krishnan
>>>>
>>>> On Thu, Aug 18, 2011 at 10:42 AM, MAC <macatad...@gmail.com> wrote:
>>>>
>>>>> any suggestion on how to approach this problem ??
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Aug 17, 2011 at 10:37 PM, MAC <macatad...@gmail.com> wrote:
>>>>>
>>>>>> Given n arrays, find n number such that sum of their differences is
>>>>>> minimum. For e.g. if there are three arrays
>>>>>>
>>>>>> A = {4, 10, 15, 20}
>>>>>> B = {1, 13, 29}
>>>>>> C = {5, 14, 28}
>>>>>>
>>>>>> find three numbers a, b, c such that |a-b| + |b-c| + |c-a| is minimum
>>>>>>
>>>>>>
>>>>>> where a E A , bEB , cEC
>>>>>>
>>>>>> . Here the answer is a = 15, b = 13, and c = 14
>>>>>>
>>>>>>
>>>>>> if we had 4 arrays we would have wanted
>>>>>> |a-b| + |b-c| + |c-d| +|d-a| where a E A , bEB , cEC and dED  to  be
>>>>>> minimum ...
>>>>>>
>>>>>> --
>>>>>> thanks
>>>>>> --mac
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> thanks
>>>>> --mac
>>>>>
>>>>>  --
>>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> thanks
>>> --mac
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> thanks
> --mac
>
>  --
> 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