Re: [algogeeks] Re: Finding Minimum Triplet

2011-11-29 Thread kumar raja
he distance of a triplet (a,b,c) is defined is *max*(|a-b|, |b-c|, |c-a|) is the correct one... On 29 November 2011 11:09, atul anand wrote: > @Raja : distance is defined as > > The distance of a triplet (a,b,c) is defined is *max*(|a-b|, |b-c|, |c-a|) > > OR > > The distance of a triplet (a,b,c

Re: [algogeeks] Re: Finding Minimum Triplet

2011-11-29 Thread atul anand
@Raja : distance is defined as The distance of a triplet (a,b,c) is defined is *max*(|a-b|, |b-c|, |c-a|) OR The distance of a triplet (a,b,c) is defined is *min*(|a-b|, |b-c|, |c-a|) On Tue, Nov 29, 2011 at 11:50 PM, Dave wrote: > @Kumar: Let the three arrays be a, b, and c, of lengths na, n

Re: [algogeeks] Re: Finding Minimum Triplet

2011-11-29 Thread kumar raja
Thanku sir... On 29 November 2011 10:20, Dave wrote: > @Kumar: Let the three arrays be a, b, and c, of lengths na, nb, and > nc, respectively. > Sort each array. > Set ia = 0, ib = 0, ic = 0. > Record the triplet (a[0], b[0], c[0]) as the best so far. > Loop >Increment the index correspondin

[algogeeks] Re: Finding Minimum Triplet

2011-11-29 Thread Dave
@Kumar: Let the three arrays be a, b, and c, of lengths na, nb, and nc, respectively. Sort each array. Set ia = 0, ib = 0, ic = 0. Record the triplet (a[0], b[0], c[0]) as the best so far. Loop Increment the index corresponding to the smaller of a[ia], b[ib], and c[ic]. If the incremented i