DSAreport
DSAreport
GROUP MEMBERS
Abdullah Sajid ( 01-135231-003)
Introduction
In this project, we developed an algorithm to help a traveler in an emergency situation reach their
destination as quickly as possible. The traveler must navigate through a network of cities connected by
roads and aerial routes. The constraints include a maximum number of cities that can be traveled by
road per day and specific rules for using aerial routes. The objective is to determine the minimum
number of days required for the traveler to reach the destination city from the starting city.
Problem Statement
Given a network of cities connected by roads and aerial routes:
The traveler can travel up to 6 cities by road per day.
The traveler can use aerial routes to travel between cities instantaneously within a day.
The traveler cannot stop in a city that has an aerial route leading back to a previously visited
city.
The goal is to determine the minimum number of days required to travel from the starting city
to the destination city.
Input Description
For each test case:
Output Description
For each test case, the output should be the minimum number of days required for the traveler to reach
the destination city from the starting city.
Example
Input:
Copy code
1 30 2 2 21 10 25
Output:
Copy code
Methodology
Graph Representation
Adjacency List for Roads:
The network of cities and roads is represented using an adjacency list where each city points to its
directly connected neighboring cities.
Queue Management:
Each entry in the queue includes the current city and the day count. The algorithm explores each
neighboring city, adding them to the queue if they have not been visited or if a shorter path is found.
Libraries: Standard Template Library (STL) for data structures such as queues and vectors.
Implementation
Step-by-Step Process
Input Parsing:
Read the number of test cases.
For each test case, read the number of cities and the number of aerial routes.
Graph Construction:
Create an adjacency list to represent the road connections between cities.
Store the aerial routes as pairs of source and destination cities.
Output Generation:
For each test case, output the minimum number of days required to reach the destination city.
Optimization Check:
Edge Cases:
[Include screenshot of results for edge cases, such as cities with no aerial routes or only one possible
path]
Performance Evaluation:
Conclusion
By the end of this project, we successfully developed a C++ program that computes the minimum
number of days required for a traveler to reach the destination city from the starting city under the
given constraints. The solution efficiently handles the constraints of road travel limits and aerial route
usage, providing quick travel decisions in emergency scenarios.
Acknowledgments
We would like to thank our course instructor, MAM MARYAM ASLAM, for her guidance and support
throughout this project. We also appreciate the collaborative efforts of our group members in making
this project successful.