Here's what I'm trying to accomplish: I have two sets of numbers and and I need to pair the numbers from set A with numbers from set B in any way possible to get the lowest absolute difference in all the pairs combined.
ex. A[4, 10] and B[2, 10] : 4->2, 10->10 [diff: 2]
Wouldn't want this: 4->10, 2->10 [diff: 14]
I know that brute force won't cut it in this problem because getting about 15 numbers will already take too long. I tried thinking about how to do linear regression and maybe borrowing some ideas from that but nothing came of it so far. Also, thinking about whether it would ever be a good idea to pair sets of sequential numbers out of order as in:
ex. A[a, b] where a < b and B[i, j] where i < j
I don't see a situation where it would be advantageous to pair a->j and b->i. This out-of-order pairing would always yield an equal or higher difference.
Anyway, there must be some method to break it down but I've been thinking on it for several days and can't come up with anything yet. Maybe it's something obvious but someone please enlighten me!
ex. A[4, 10] and B[2, 10] : 4->2, 10->10 [diff: 2]
Wouldn't want this: 4->10, 2->10 [diff: 14]
I know that brute force won't cut it in this problem because getting about 15 numbers will already take too long. I tried thinking about how to do linear regression and maybe borrowing some ideas from that but nothing came of it so far. Also, thinking about whether it would ever be a good idea to pair sets of sequential numbers out of order as in:
ex. A[a, b] where a < b and B[i, j] where i < j
I don't see a situation where it would be advantageous to pair a->j and b->i. This out-of-order pairing would always yield an equal or higher difference.
Anyway, there must be some method to break it down but I've been thinking on it for several days and can't come up with anything yet. Maybe it's something obvious but someone please enlighten me!