Thanku sir...

On 29 November 2011 10:20, Dave <dave_and_da...@juno.com> 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 corresponding to the smaller of a[ia], b[ib],
> and c[ic].
>    If the incremented index reaches its corresponding length, break
> the loop.
>    If the new (a[ia], b[ib], c[ic]) is better than the best so far,
> update the best so far.
> End loop
>
> O(n log n), where n = max(na,nb,nc).
>
> Dave
>
> On Nov 29, 11:42 am, kumar raja <rajkumar.cs...@gmail.com> wrote:
> > Given three arrays, find the triplet (containing one element from each
> > array) with the minimum
> > distance. The distance of a triplet (a,b,c) is defined is max(|a-b|,
> |b-c|,
> > |c-a|)
> >
> > --
> > Regards
> > Kumar Raja
> > M.Tech(SIT)
> > IIT Kharagpur,
> > 10it60...@iitkgp.ac.in
>
> --
> 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.
>
>


-- 
Regards
Kumar Raja
M.Tech(SIT)
IIT Kharagpur,
10it60...@iitkgp.ac.in

-- 
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