Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Introduction Do not use the Java built - in ADTs - if in doubt, ask. * * please do in Java not python The assignment
Introduction
Do not use the
Java builtin ADTs if in doubt, ask.
please do in Java not python
The assignment is based on the application of graph, hashing, sorting data structures. Read
carefully the following given problems. Your program should have an interactive menu to call
the necessary functions or methods and check for errors and exceptions.
Problem : Implementing BFS for Route Discovery in an Airline Management System
Develop a BreadthFirst Search BFS algorithm to discover all possible flight routes from a
given origin to a destination airport, considering a constraint on the number of allowed layovers
eg no more than two This task will simulate route finding in realworld scenarios where
direct flights are unavailable, or flexibility is needed due to peak travel times.
In airline systems, routes between airports can be represented as graphs, where nodes are
airports and edges are flights connecting these airports. BFS is an ideal algorithm for exploring
such graphs layer by layer, making it wellsuited for finding all potential routes up to a certain
depth, corresponding here to the number of layovers.
Graph Representation: marks
You are to represent the airline network as a graph using an adjacency list, where each node
airport holds a list of tuples. Each tuple represents a connecting flight and contains the
destination airport and the distance of the flight.
BFS Algorithm Implementation: marks
Implement the BFS algorithm to traverse the graph from the origin airport to the destination
airport. The algorithm should explore all routes within the specified maximum number of
layovers.
Maintain a queue that holds tuples of the current airport, the current path taken list of airports
visited and the cumulative travel distance.
As you explore each airport node check all possible onward flights edges If the destination
is reached within the layover limits record the route; otherwise, continue to the next possible
airports.
Displaying the Results: marks
For each valid route found, display the route in terms of the sequence of airports, the total
number of layovers, and the cumulative travel distance.
Ensure the results are clear and provide all necessary information for potential passengers to
understand their travel options.
Problem : Hashing for Efficient Airport Lookup marks
Implement a hashing mechanism to efficiently lookup airport information based on airport
codes. Suppose we have the following airport information:
Airport Code: MEL, Name: Melbourne Tullamarine MEL
Airport Code: JFK Name: John F Kennedy International Airport
Airport Code: LAX, Name: Los Angeles International Airport
Airport Code: LHR Name: London Heathrow Airport
Airport Code: BKK Name: Bangkok Suvarnabhumi Airport
Students should implement a hash table where airport codes are used as keys to quickly retrieve
airport information following the instructions:
Design a hash function that converts airport codes into indices for the hash table. marks
Implement collision resolution techniques with linear probing. marks
Provide functions for inserting, searching, and deleting airport information from the hash table.
marks
Problem : Heap Sort for Optimal Route Selection marks
After discovering all possible routes using BFS implement a heap sort algorithm to sort the
routes based on either total travel distance or the number of layovers. Allow passengers to
choose the optimal route based on their preference, whether it's minimizing layovers or
minimizing travel distance.
Implementing Heap Sort: marks
Heap sort is a comparisonbased sorting algorithm that can efficiently sort routes based on total
travel distance or the number of layovers.
Instructions:
Implement the heap data structure to organize routes based on the selected criteria.
Utilize heap operations such as heapify to sort the routes inplace.
Ensure that the implementation handles both criteria total travel distance and number of
layovers effectively.
Allowing Passenger Preference: marks
Enable passengers to choose the optimal route based on their preference, whether it's
minimizing layovers or minimizing travel distance.
Instructions:
Add one option in interactive menu to allow passengers to specify their preference for route
selection.
Implement logic to select routes based on the specified preference criteria and display the
result.
Further research option: Option to get additional marks, which can be adjusted with
your total marks
Compare the performance of heap sort with other sorting algorithms in terms of time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started