Skip to content

ahmetbarisdurak/BusTourProblem

Repository files navigation

Problem Definition

Imagine you are at a bus stop with no information about the bus schedule, including bus numbers, bus names, and their arrival periods. Your task is to analyze the recorded arrival times of buses passing through the stop and determine:

1. The number of different bus lines operating at this stop.
2. The arrival periods for these different bus lines.

Solution Overview 

To solve this problem, I have developed a C++ program called BusTour.cpp that performs the following steps:

1. Data Generation
First generate random bus arrival times within a specified time range. The generated data simulates the real-world scenario where you are recording bus arrival times without prior knowledge of the schedule.

2. Data Analysis
Analyze the recorded bus arrival times to identify different bus lines and their arrival periods. The analysis consists of two main parts:

a. Identifying Stable Periods
Look for patterns in the data to identify stable periods during which buses from the same line arrive consistently with the same period number.
These stable periods represent one bus line. We determine the length of these stable periods and try to check if they fit the bus times.

b. Finding Alternating Periods
Try to find alternatig periods first in the bus times for much better results. 
These alternating patterns may indicate multiple bus lines with different arrival periods. We identify alternating periods and provide information about these bus lines as well.

3. Output
The program outputs the following information:

The number of different bus lines found at the bus stop.
For each bus line:
The stable arrival period (if identified).
The alternating arrival periods (if identified).


Running the Program

To use this program:

Compile the BusTour.cpp source code.
Run the compiled program.
Observe the output to learn about the different bus lines and their arrival periods.


Conclusion
With this program, you can make sense of bus arrival times recorded at a stop, even without prior knowledge of bus schedules. 
It helps identify different bus lines and their respective arrival periods, providing valuable information for commuters and transportation planners.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors