What search stategy do you use for the following application? You\'re writing a
ID: 3702341 • Letter: W
Question
What search stategy do you use for the following application?
You're writing a program that maintains the lists of passengers on flghts for an airlinr company. Passengers are frequently added to these lists. Moreover, passengers often cancel flight plans and must be removed from a list. You are also told that the airline frequently wants to alphabatize listings of the passengers on a given flight and often need to search out a particular passenger by name when inquiries are received from individuals.
Explanation / Answer
Solution:
There is a point which needs to be noted to decide about the search strategy we are going to use,
the point is
This means that he list needs to be in sorted order when it is getting saved and the passenger name should be removed from the list as well.
So, according to the given scenario Binary Search is the best strategy here, and we will be building Binary search tree of the passengers while building hte list, so that it can be present in an alphabetical order.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.