Bölüm 4.2 · SimülatörTravelling Salesman Problem? ← Bölüm 4.2 Cities Generate Nearest Neighbor Brute Force Cancel Ready. KapatTravelling Salesman ProblemGenerate cities and compare a fast Nearest Neighbor heuristic with an exact Brute Force search. Distances are Euclidean distances on the drawing (in pixels).How to useChoose the number of cities (2–10) and press Generate to place them randomly.Nearest Neighbor shows the candidate edges from the current city at each step, then extends the tour.Brute Force enumerates every tour starting at city 0; the best tour found so far stays visible. It is limited to 9 cities.Run both on the same cities: the side panel shows how far the heuristic tour is above the optimum. Cancel stops a run.Nearest NeighborAt each step, the current city moves to the nearest unvisited city. It is fast, but it does not guarantee the optimal tour.Brute ForceChecks every possible tour while fixing one city as the starting point. It finds the optimum, but its factorial growth makes it practical only for small inputs.ComplexityMethodTimeResultNearest NeighborO(n²)Heuristic, not always optimalBrute ForceO(n!) — (n − 1)! toursOptimal