Consider the travelling salesman problem where a salesman travels several cities where:

  • He departs from and returns to the same city
  • Every time he travels to the closest city, i.e. having shortest distance from origin.

Given the input as a text file having the adjacency matrix, i.e. matrix containing the distance between each pair of cities, write a program that parses this input and allows the user to choose a city of departure and builds a circular linked list where each node contains the name of the visited city and the distance from the previous city.

Then, the program displays:

  • the path obtained from the circular linked list, i.e. list of visited cities in order based on the choice provided by the user
  • the optimal path, i.e. the least overall distance and its corresponding city that should be chosen as city of departure and it corresponding path

Your program should have:

  • City class to store the name of the city and the cost to go to that city. The cost should be populated, in runtime, after choosing the city of departure
  • Node Class and CircularLinkedList class: You can build on the ones that we saw in class
  • Source .cpp file contains the main method to parse the text file and contains the main logic of your program

Deliverable: zipped file of the Visual Studio project file.

Note: The matrix is symmetric so only the upper part is provided. You should parse it as string then transform the distances to integer. You can name the cities as you wish. You can define a string array string cities[4] = {“a0”,”a1”,”a2”,”a3”}; assuming a0, a1, a2 and a3 correspond to the cities represented by 1st, 2nd, 3rd and 4th rows/columns.


-    3    2    5
-    -    1    6
-    -    -    7
-    -    -    -

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.