algorithmsortingdate-sorting

Determine shortest time frame


Is there an algorithm for determining the shortest timeframe in which one could see a baseball game at each stadium. Is there also a way to specify a travel path, the order in which I visit stadiums? I have provided a google doc listing days each California MLB team has a home game for May 2016.

2016 CA MLB May Home Games


Solution

  • The problem you task about is the Traveling Salesman Problem. I will not provide the full answer as this is a homework but you can start looking at:

    1. Depth first search
    2. Breadth first search

    These are searching algorithm that will check every possible node and vertices. With the correct implementation you can use this solution be check every possible station with a "distance".