Create a data structure that supports the following functions:

  • Import and delete flights. After these, the tree always has to keep its form as a binary search tree as far as the depart time is concerned and the field MAX_AR has correct value in every node.
  • When a time period is given, the system shall return a flight that is active in this period. Please note that active are also the flights that started or ended in this period of time . For example if time period is [12,14] then flight SW489, CA863 and OA345 are active in this period of time.
  • Make the previous Question (B) more general by making the system return all the flights that are active in a given period of time.
  • Given a time h , the system shall return the Arrival of that flight, that has depart time before h and is completed last amongst the flights that their arrival is before h. For example if h=11.30 then the system has to return 16.30 because that is the Arrival of SW489 flight , the one that has started before 11.30 AND also is complete later than all the flights that have started(departed) before 11.30.
  • In any case, you must minimize the number of comparisons demanded during the execution of these functions .You also don’t have to use balancing functions after adding or deleting a flight from the tree.

See the example binary tree example: See image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.