0

I'm currently learning about the TSP and want to combine two simple heuristics in one algorithm. It works by using the nearest neighbour algorithm to create a tour and then improving it by using a 2 opt swap for every combination. I believe the number of steps for the 2 opt technique is n(n-1), so O(n) = n^2. However, I don't know how to calculate the complexity for the nearest neighbour algorithm. I likely the think it will result to O(n^2) but I am not certain about the process to get to this.

Okeh
  • 163
  • 1
  • 7
  • Well that depends on the *implementation* of the nearest neighbor: you can go as fast as *O(log n)* *after* constructing a *Vornoi* diagram in *O(n log n)*.. – Willem Van Onsem Aug 30 '18 at 06:50
  • This paper (https://web.tuke.sk/fei-cit/butka/hop/htsp.pdf) describes what I guess would be the most time consuming (but easiest to understand) implementation of the NN algorithm. Could you please explain (or give me some resources) to understand the implementation you are describing? I've found this http://www.dtic.mil/dtic/tr/fulltext/u2/a256112.pdf but its honestly a little over my level @WillemVanOnsem – Okeh Aug 30 '18 at 10:13

0 Answers0