@SOURABH:As explained correctly by *Yq* ,it's a greedy approach....., when u
find the min(x,y,z) and take with difference with max(x,y,z) to find the
triplet distance, you see that if you consider that min(x,y,z) with other
tuples of the other two variables , the max difference either remains same
or increases as the arrays are sorted in nondecreasing order. As you are
asked to find the minimum of such max difference(triplet distance) ,, its
meaningless to find out the triplet difference >= current triplet
difference. So to discard that path we increment the index of smallest
variable by one.

@Nikhil/Swapnil: No point discussing O(1) . It's never possible better than
O(n1+n2+n3).

On 21 December 2010 02:10, Saurabh Koar <saurabhkoar...@gmail.com> wrote:

> @yq: Can u plzz inform what was ur approach/logic while deriving the
> condition that "index will be increased of that array which contains
> minimum of three elements to get the desired ans"?
> It will be very helpful.Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Thanks & Regards,
Priyanka Chatterjee
Final Year Undergraduate Student,
Computer Science & Engineering,
National Institute Of Technology,Durgapur
India
http://priyanka-nit.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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