alphacyberranger to Programmer [email protected]English • 7 months agoNot everything can be done in constant time, that's O(k)sh.itjust.worksimagemessage-square28fedilinkarrow-up1410arrow-down110
arrow-up1400arrow-down1imageNot everything can be done in constant time, that's O(k)sh.itjust.worksalphacyberranger to Programmer [email protected]English • 7 months agomessage-square28fedilink
minus-squaremagic_lobster_partylinkfedilink36•7 months agoYou have two lists of size n. You want to find the permutations of these two lists that minimizes a certain distance function between them.
minus-square@[email protected]linkfedilink2•7 months agoSurely you could implement this via a sorting algorithm? If you can prove the distance function is a metric and both lists contains elements from the same space under that metric, isn’t the answer to sort both?
minus-square@[email protected]linkfedilink7•7 months agoIt’s essentially the traveling salesman problem
You have two lists of size n. You want to find the permutations of these two lists that minimizes a certain distance function between them.
Surely you could implement this via a sorting algorithm? If you can prove the distance function is a metric and both lists contains elements from the same space under that metric, isn’t the answer to sort both?
It’s essentially the traveling salesman problem