Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assume you are given a set of N < 10 cities with pairwise distances between them represented as real numbers. A traveler starts from city #1 and wants to visit all other cities just once and return back to the origin. Assume there is a direct airline between any two of these N cities. Your task is to design a C++ program that will find an optimal route for the traveler. That is, the program should return a route of minimum total length. Assuming that the traveler always starts from city 1 the output of the program for N = 4 should be of the form
1 -> 2 -> 4 -> 3 : 226.6

where the last number is the minimum total distance.

Create a file dist.dat for storing the pairwise distances represented as an NxN table of numbers. The number at the intersection of the i-th column and j-th row is the distance from city i to city j. So the table is symmetric; that is, the number at the intersection of row i and column j is the same as the one at the intersection of column i and row j. Note that the number N of cities is not presented explicitly in the file, your program has to figure it out. Your program should read the data from the file by using the input redirection.

Example of such file for N = 4:

56.78 11.80 79.34 78.23
11.80 16.26 65.23 45.19
79.34 65.23 63.29 90.27
78.23 45.19 90.27 87.35

Create your own file for at least 7 cities.
Your program should work for any N in the range [3..10]

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9207079

Have any Question?


Related Questions in Computer Engineering

Question need to discuss on issues and security

Question: Need to discuss on issues and security vulnerabilities caused by using 4 digit pin while accessing Banking. 1) Abstract 2) Acknowledgement 3) List of Abbreviations 4) Table of contents 5) List of tables 6) List ...

Why is it important to back up the dhcp database and

Why is it important to back up the DHCP database and Identify key files that make up the DHCP database?

Question you company provides wireless networking services

Question: You company provides wireless networking services. One of your customers complains about the downloading performance being poor. After investigation, you find that the customer's 802.11 wireless network is inte ...

Three mutually exclusive new designs for an aircraft engine

Three mutually exclusive new designs for an aircraft engine are under consideration. The engine has a ten-year life. The first engine incurs a cost of $1.2 million for a net saving of $300,000 per annum as compared to an ...

Which of the subsequent statements is correct with regard

Which of the subsequent statements is correct with regard to distributed systems ? a. Distributed system represents a world read of the network and considers it as a virtual uniprocessor system by dominant and managing r ...

Question part 1 answer below question with atleast 350

Question: Part 1: answer below question with atleast 350 words in APA format no plagrism and also I need two professional refrences 1) What is the power of scenario planning Part 2: answer below question with atleast 350 ...

What are security planning principles what is policy-based

What are Security Planning Principles? What is policy-based security? (Hint for both: pure definition is not good enough. Answers need to be illustrated in the context of an example or scenario).

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks

Question rns versus gsd representation we are contemplating

Question : RNS versus GSD representation We are contemplating the use of 16-bit representations for fast integer arithmetic. One option, radix-8 GSD representation with the digit set [-5,4], can accommodate four-digit nu ...

We can sort a given set of n numbers by first building a

We can sort a given set of n numbers by first building a BST containing these numbers (using insertion operations on each element one by one), and then printing the numbers by an inorder traversal. What are the worst cas ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As