当前位置: 动力学知识库 > 问答 > 编程问答 >

Reorder an array such that the sum of absolute differences with another array is minimized

问题描述:

Given two (unsorted) arrays with equal size, a and b. What is the algorithm that minimizes sum(abs(a-b)) by reordering b? The easiest solution is to enumerate all the permutations of array b, but do we have a faster algo, or is this just problem NP hard?

分享给朋友:
您可能感兴趣的文章:
随机阅读: