One-way flight trip problem « Ajeet Singh
You are going on a one-way indirect flight trip that includes an unknown very large number of transfers. You are not stopping twice in the same airport. You have 1 ticket for each part of your trip. Each ticket contains src and dst airport. All the tickets you have are randomly sorted. You forgot the original departure airport (very first src) and your destination (last dst). We need to design an algorithm to reconstruct your trip with minimum big-O complexity.
Observation from the info provided in problem statement:
1. If I do not remember the order in which I visited these places, than off course i dont remember the starting location.
2. But I know my current location – end of my journey.
3. End place of one journey is starting place for another journey.
Read full article from One-way flight trip problem « Ajeet Singh
No comments:
Post a Comment