c homework 9

When you have no idea what to do with your written assignments, use a reliable paper writing service. Now you don’t need to worry about the deadlines, grades, or absence of ideas. Place an order on our site to get original papers for a low price.


Order a Similar Paper Order a Different Paper

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.

Matrix

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

Writerbay.net

Get help with your complex tasks from our writing experts. Kindly click on ORDER NOW to receive an A++ paper from our masters- and PhD writers.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper