Prev Up Next
Go backward to 6.13 Cross Country Trip Simulation #1
Go up to 6 Labs
Go forward to 6.15 Subroutines and Arguments

6.14 Simulation #2

Given a node list of distances, connections, and gas prices, simulate a cross country trip.

The node data base has the following information.

  1. Node number
  2. Price of gas at that node.
  3. Number of connection to other nodes. (Maximum 5, Minimum 0)
  4. Pairs of node numbers and distances.
Please note. A connection between nodes will be listed only once, but the connection can be traveled both directions. For example, node 5 may show a connection to node 12 of 60 miles, but node 12 will not show a connection to node 5. Travel can be either direction. From node 5 to 12 or from node 12 to 5.

Find the low cost route between any two nodes. This might not be the lowest distance route. If a gas price is low enough, you may want to consider traveling the same route both directions.

Alternate: Find the shortest distance route between to nodes.


Instructor: ltaber@pima.edu** Red's Home page** The Pima College Site

Prev Up Next