In this assignment you will simulate traffic flow for a parking system. Suppose
ID: 3776829 • Letter: I
Question
In this assignment you will simulate traffic flow for a parking system. Suppose a Parking Garage contains 2 parking lanes, each with a capacity to hold 5 cars at a time. As each car arrives/departs, the values A/G (representing arrival/get out) is entered along. Define L_i to be a lane i where you have two lanes and C_j to be car j where C_j 1 j 5. Assume that all lanes are of the same length, and all cars arrives and get out in the same time, hence, the same number of cars could be waiting in a line in each lane. Only 5 cars can wait in each lane. However, different lanes have different waiting rules according to their data structures, as are listed in the table below: When a car arrives to the parking garage, the parking staff enters the car into the lane. However, customers may also ask the staff to get their cars out of the garage at any time Keep in mind that any (entering/existing) operation (corresponding to moving any car into or out of any lane) cost 1 KD. Test the program on each data structure using the following parking operations, which data structure is cheaper? Your program should be well-structures and well-documented. Indicate the expected time and space complexity of your programExplanation / Answer
yes this question can be implemented using stack and queue both but i this this is very welll using stack because stack have LIFO structure