Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem (100 points) In this projcct,u will code the Dijsktra algorithm, as it was discussed in class. The algorithm will be uscd to cakculate the

image text in transcribed

image text in transcribed

Problem (100 points) In this projcct,u will code the Dijsktra algorithm, as it was discussed in class. The algorithm will be uscd to cakculate the distance berween the capital of the first US state (we call it state 0), and the capitals of the rest of the 48 states forming the contingent United States. (Alaska and I lawaii excluded) 1-Input Data representing the distances between all the ca pitals will be stoned in an adjacency matrix. Since there is 48 The data states in the contingent Unites States, the matris will be a 48x48 matrix: int distanceMatrix(48 148] For cxample, distanccMatrx1 will be the distance betwcen the capitals of state 0 and state 1. (of course this will be exactly as distanceOD.Your code will initialize the matrix variable in the beginning of the program, using the data at the end of this project. Naturally, the distance between each capital and it self to be 0. Actual values are given at section "data vaues'", at the end of ts document. 2-Data Representation You will use Dzjkstra's algorithm to calculate the shortest path trom the capital of state {) to all other capitals. To map the racing table used in class while trace the progress of Dijkstra's algorithm, you will use the following vertex class (matching the tracing table on the righty: known p? class vertex public boolean known; public int distance; public int previousvertex; / the P. column the known column / the d, columrn and you will create an array of vertex. In order to match the class example, you will need a matrix of 7 vertexes, such as: oc 0 vertex vertexArray To represenl inlinty, we will use abg nL value (i e 9999). An exarnple nual value o[the second vertes, maching the example table on the right will he vertexArray1. known false ver texArrayt1.distance 999p; vertexArray1] previousvertex 0 for the state capital problem we are solving in this problem, you will use a vertex array of 48 elements Problem (100 points) In this projcct,u will code the Dijsktra algorithm, as it was discussed in class. The algorithm will be uscd to cakculate the distance berween the capital of the first US state (we call it state 0), and the capitals of the rest of the 48 states forming the contingent United States. (Alaska and I lawaii excluded) 1-Input Data representing the distances between all the ca pitals will be stoned in an adjacency matrix. Since there is 48 The data states in the contingent Unites States, the matris will be a 48x48 matrix: int distanceMatrix(48 148] For cxample, distanccMatrx1 will be the distance betwcen the capitals of state 0 and state 1. (of course this will be exactly as distanceOD.Your code will initialize the matrix variable in the beginning of the program, using the data at the end of this project. Naturally, the distance between each capital and it self to be 0. Actual values are given at section "data vaues'", at the end of ts document. 2-Data Representation You will use Dzjkstra's algorithm to calculate the shortest path trom the capital of state {) to all other capitals. To map the racing table used in class while trace the progress of Dijkstra's algorithm, you will use the following vertex class (matching the tracing table on the righty: known p? class vertex public boolean known; public int distance; public int previousvertex; / the P. column the known column / the d, columrn and you will create an array of vertex. In order to match the class example, you will need a matrix of 7 vertexes, such as: oc 0 vertex vertexArray To represenl inlinty, we will use abg nL value (i e 9999). An exarnple nual value o[the second vertes, maching the example table on the right will he vertexArray1. known false ver texArrayt1.distance 999p; vertexArray1] previousvertex 0 for the state capital problem we are solving in this problem, you will use a vertex array of 48 elements

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

Explain the first two principles of systems analysis and design.

Answered: 1 week ago

Question

Distinguish between formal and informal reports.

Answered: 1 week ago