Hi - I'll pass - this looks like HOMEWORK! Please put on your thinking cap and try it...
> -----Original Message----- > From: Nengbing Tao [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 24, 2003 3:00 AM > To: [EMAIL PROTECTED] > Subject: Pairs have minimum difference > > > Hi, ALL, > > I thought there should be a solution/algorithm already to > this problem > and would like to check here first. > > > The problem: To return all the pairs (one number from each array, one > number can only be in one pair) that have the smallest sum of absolute > differences from two arrays. > > For example > > my @xa=(8765,6000,4765,3000,1530,1500,1465,1234,1000); > my @xb=(8675,6000,4567,3100,3000,1545,1515,1485,1324,1005); > > to return: > diff num_1 num_2 > 0 3000 3000 > 0 6000 6000 > 5 1000 1005 > 15 1500 1515 > 15 1530 1545 > 20 1465 1485 > -90 8765 8675 > 90 1234 1324 > -198 4765 4567 > . 3100 > > Notice that |1500-1485|=|1500-1515|. > > > Many thanks! > > > Nengbing > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]