-
This algorithm is designed to find the index of the city to start a round trip with given a list of city distances, fuel at gas stations, and the car's miles per gallon that is able to make a round trip without running out of fuel.
-
To run the algorithm, make sure you have Python installed on your computer. You can download Python at https://www.python.org/downloads/.
- Open VSCode
- Open the hamilton.py file in VSCode
- Open the terminal in VSCode by clicking on Terminal -> New Terminal in the menu bar
- Click the Run button in the top menu bar
- To test different test cases, modify the values of city_distances, fuel, and car_mpg in the code and run the Python file. Make sure to use valid values for these variables.
- Note the input for this algorithms is:
- city_distances is a list,
- fuel is a list
- car_mpg is an integer
- The output will be the index(an integer) of the best city to start the round trip with