Define difference between any two of these n citie

Assignment Help Computer Engineering
Reference no: EM1331709

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]

Reference no: EM1331709

Questions Cloud

International and cross-cultural negotiations differ : Discuss in what way international and cross-cultural negotiations differ.
Strategic plan development for tuffs : Strategic Plan Development for Tuffs-NEMC Could you please assist me in understanding the development of the Executive Summary
New home sellers in a given market decreases : The number of new home sellers in a given market decreases.
Handling the death penalty case : List the various courts and hearings that will typically occur and how the case is affected by each event.What are the relevant civil liberties issues pertaining to the 4th, 5th, 6th, 8th, and 14th Amendments present in this case?
Define difference between any two of these n citie : design a file dist.dat for storing 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.
Describing virtual group charter : Suggest a formal "Virtual Group Charter." At a minimum, the charter should contain a group name, specific rules for engagement, norms of expected behavior, and selection of a formal leader.
Organizational ethics and social responsibility : Description of Organizational Ethics and Social Responsibility - The company lost some great people because performance was not considered, only seniority.
Management of resources : The management of the human element of the organization or the management of technology?
Standard form contracts : Standard and bespoke contracts - Compare the relative advantages and disadvantages of standard form contracts and "bespoke" individually negotiated contracts

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain protocol and architecture

define Connection Oriented Protocol and Connectionless Protocol.

  Health care services

Compare and contrast the cost-effectiveness, benefit-cost, and cost-utility analysis and find which is most useful to assess value of the health care services overall.

  Determining the output of code

Provide the output of the following given program:#include using namespace std; void fun1 (int *p, int *&q) {*p = 100;p = p + 2;*p = *q; *q = *(p+1);

  Program to calculate the weight of students

We have run regression analysis along with the resulting estimated regression equation as follows:” the estimated weight equals (-180 pounds) plus (5 pounds times the height in inches).” Write down the program to calculate the weight of students.

  Make a java application for a mail order company

Write down a Java application for a mail order company that uses a data entry screen in which the user types an item number and a quantity. Write each record to a file named as "MailOrderRecords.txt".

  What are the reasons why systems fail

What must be management's role in the system development life cycle.

  Minimum size of instruction

An imaginary computer has the 16 data registers (R0 to R3), 1024 words in memory, and the 16 different instructions (add, subtract, etc.). Explain the minimum size of the instruction in bits.

  What will offer as a network suggestion

With true VPN access to basically an Intranet Environment at each office; there really should not be any need for "Routing" per se unless I am missing something. I only have 2 days for this project before I head back to field, so I just need some ..

  Demonstrate that the expected search time for hashing

Demonstrate that the expected search time for hashing

  Write down a program that inserts 25 random integers

Write down a program that inserts 25 random integers from 0 to 100 in order into a linked-line object. The problem must calculate the sum of the elements and the floating-point average of the elements.

  Prepare a use case diagram

Prepare a Use Case Diagram based on the given problem description.

  Determining the salary of person

Write down a program which determines how much a person earns in a month in case the salary is one penny first day, two pennies second day, four pennies the third day, and so on with the daily pay doubling each day employee works.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd