Create a program which will read in a set of values for the cost of moving betwe

Sigchi4life
Category:
Computer Science
Price: $45 USD

Question description

Create a program which will read in a set of values for the cost of moving between two nodes in a graph and determine the minimum cost for connecting all nodes. The data will consist of statements in the following form.
NumNodes
Node1 Node2 Cost
NumNodes will be the number of nodes in the graph (maximum of 12). Node1 and Node2 are single alphabetical characters (upper case) and Cost is a positive (> 0) integer value. There will be one statement per line. The nodes will be lettered in alphabetical order (i.e. if there are six nodes they will be A, B, C, D, E, F. The cost of moving between nodes is not symmetrical (i.e. the cost of moving from A to B may be different from the cost of moving from B to A).
Note: There may not be a path connecting every node (i.e. A may connect to B and B may connect to C but there may not be a path from A to C). If there is not a statement A C Cost, it is implied that there is no connection from A to C.
Output will be the cost of the minimum path through the nodes and the list of nodes visited (in the order visited). If there is no unique minimum path, you may display any of the minimum paths found.
Also note that the list is not circular (that is you do not need to return to the starting point).


BONUS: There is a 25 point bonus if you have a working non-recursive solution.

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UCLA
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors