Use AVL tree.
Topic: Cars on a National Highway
Consider a national highway H, which goes in a straight line and has two-
way traffic. Further, vehicles can enter or leave the highway through the various
side roads joining it.
The location of a vehicle on the highway at any given instant of time is given
by a unique real number in the range R. Further, the current time curr
takes increasing, positive real values starting from initial value of 0. All vehicles
on the highway travel at the uniform speed of 1 unit distance per 1 unit time.
Each vehicle has a unique registration number, which we take to be a non-
negative integer value for the purposes of this assignment.
You have to implement a data structure, which maintains the state of the
highway in a suitable format, and answers queries about its traffic.
1
Expert's answer
2019-09-09T05:02:31-0400
Dear Sanjay, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Comments
Leave a comment