The data structure Min-Heap is not the most efficient to store the parking spots in the order of the shortest distance from the entrance.
Clearly this will be inefficient if there are multiple entrances and multiple entry gates. The following step can cause the entire heap to be re-constructed.
- We mark the parking spot as reserved and remove it from the available set. We also remove it from the min-heaps of other entrances.
A tree map would be a better data structure to be used here.
Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Class Diagram for the Parking Lot