This is related to travelling salesman problem. First all permutations need to be generated and then the destination (same as origin) attached. I.e.: 1) abcd abdc ....
2) abcda abdca ....a
I have all the distances and only need an algorithm to sum them up. I wonder if there is an algorithm (C preferable) I can use for this or if there is a ready-made solution somewhere.