Lets say I have four group
A [ 0, 4, 9]
B [ 2, 6, 11]
C [ 3, 8, 13]
D [ 7, 12 ]
Now I need one number from each group(i.e a new group) E [num of A,num of B, num of C, num of D], such that the difference between the maximum num in E and minimum num in E should be possible lowest.What type of problem is this ? which graph algorithm will be better to solve this kind of problem ?
Thanks in advance.
P.S : I'm trying to solve this in java and sorry for the unspecified title.
Finally I've found what I'm actually looking for http://rcrezende.blogspot.in/2010/08/smallest-relevant-text-snippet-for.html