So i have path A and B and weights of objects in path, for example:
A = [5, 4, 2, 1, 3, 8, 7, 6, 9]
B = [2, 3, 4, 1, 9, 7, 8, 6, 5]
and weights, for example:
W = {1:1000, 2:500, 3:200, 4:400, 5:700, 6:250, 7:100, 8:50, 9:900}
and I want to replace A to B with using lowest weight, for example if we want to replace 6 and 8, the used weight is: 50+250=300
what algorithm of sorting should i use etc?
Aucun commentaire:
Enregistrer un commentaire