Interface BusConnectionAlgorithm

All Superinterfaces:
edu.gwu.algtest.Algorithm

public interface BusConnectionAlgorithm extends edu.gwu.algtest.Algorithm
Interface BusConnectionAlgorithm needs to be implemented by any algorithm that wishes to solve the Bus-Connection problem.
  • Method Details

    • analyzeRoutes

      void analyzeRoutes(BusInfo[] buses)

      In method analyzeRoutes(), you are given a list of buses via their BusInfo instances. Here, the busNumber and forwardRoute are given to you. What you need to do is use this to perform some analysis in preparation for finding connections. Alternatively, you can merely store the information and perform all the analysis when findConnections() is called. Also, the buses will be provided in bus-number order so that buses[k].busNumber = k
    • findConnections

      BusInfo[] findConnections(IntPoint start, IntPoint end)

      This method will be called after analyzeRoutes() has been called. The input is a start point on the grid, and an endpoint. Neither need be a bus endpoint nor even a stop point of any bus. If any one of these is not a stop point for any bus OR if a series of bus connections (hence a route) cannot be found, then you return null. Otherwise, there's a route. This is a list of BusInfo instances. Here, BusInfo is used differently. Each instance in sequence is a bus number (which you fill in), and embarkation and disembarkation stops for that bus. The disembarkation point for one bus needs to be an embarkation point for the next bus.