Getting into a top technology company is tough but not impossible, this channel is aimed at helping people prepare for technical interviews at big tech like Facebook, google, amazon etc.
If the channel videos did helped you to enhance your knowledge or clearing an interview, please do like and subscribe !
Great explanation, with pros and cons of each design decision. Covered almost all the aspects of it. This is how everyone should explain system design concepts. Thank you! please keep making for videoes.
Hey i have a question like why there is an association between parking spots and vehicle, you said that association means class A calls class B and this means that class parking spot is calling class vehicle ..can you explain why this is happening and why we have made child classes for parking spots like if this is required than vehicle class should not be required and if vehicles is required than this should not be, please explain in detail.
In the last optimization, when the elevator was moving up and dropped the passenger of floor 0 at floor 2, and picked the passenger at floor 2 who requested a down , why the elevator changed the direction and dropped them first. Shouldnt the lift continue togo up and attend the request of the passengers going up first?
that is the drawback u would say for this algorithm thats why we have to take care of one direction only by marking any of the direction as true either up or down once the lifts starts to move maintain 3 varibles as bool and mark them as true until it reaches the last pos of requested then mark as false and changes the directin of the lift so that the requested of other can also be taken care of
Good explanation but a small doubt i.e whenever a position of car changes everytime we have to pop all enteries of both minhips and update it again, so will that be efficient?
yes that might not be efficient but O(nlogn) is not asymptotically tight, search for tighter bound for hepify. It might not be awesome algorithm but can do the work rest is on our innovations.
It depends on how many people work/stay in the building, like an office with a high number of floors with 1000 people working will require more elevators than a smaller building with 300 people, its something easy and you can discuss with your interviewer to decide on this requirement.
Runtime updation of minHeap, as the elevator car crosses a floor, is equivalent to creating a new minHeap everytime? I am not sure there is any straight forward way to update the values in a minHeap/maxHeap.
There is a “decrease key” operation in the Heap which does changing of node’s value, in o(log n) runtime when it is combined with HashMap to maintain the position of node in array (Heap uses behind the scene). You may explore it further.
There might be, also you can make Door class as a base class and then inherit from it as Elevator Door, Emergency Door, Service Door etc. and then create a relationship from Door to Car class imo
Hey thanks for this video Sorry this is out of context, but what chair are you using ? I have seen this one at different places but not able to find it
haha, no worries.. I think this one is pretty close www.ikea.com/se/sv/p/markus-kontorsstol-vissle-moerkgra-70261150/ , you can get the same in any country.
when you delete the keys from freq_map, you would delete from the linked list having min_frequency. Now in a situation when the list corresponding to this min_freq has been deleted, then the min_freq will be 1 + the prev min_freq. Suppose again some one inserts a new element then new min_freq becomes 0.
The number of min heaps would be same as number of entrances. However, the nodes (spots) considered for min heaps should be disjointed - no 2 min heap to have same spot else there would be an overhead in maintaining. However doing so has another observation, if one entrance exhausts all the spots, it would then need to refer the min heap of the closest entrance. Thoughts?
we want to find all the connections to every character in the given set of words, it is possible that a character can have multiple connections. You build an adjecency list using all characters thats whay an unordered map with <char, vector> , the empty list is just to initialize the vector.
@@nikhilraj9900 beacuse you want to poulate the graph with every character in the word list, while populating its better to initialize it with {} array since we have declared the unordered map as {char, array}. Eveny if you write the code as graph[ch]; its fine.
In the last part of the video , you have used 2 heaps . When you are not using the direction of the car to pickup up the passenger , what's the point in keeping 2 heaps ? You can simply use 1 heap and pickup the closest passenger irrespective of the direction he/she wants to move. This is a bit confusing .
Thanks for pointing out. Yes, if you are not having a constraint on direction then you can use just one min heap, I wanted to give a starting algorithm which anyone can extend and optimized further. e.g.Some elevator systems pick passengers only in the dircetion of travel then the 2 heaps would help.
@@codeTreeMS This was my first thought. Starting at floor 0, it goes up until no one else needs to go up, then it starts at the top and brings down everyone who needs to go down. then start with people going up, rinse, repeat
Just create a button class, there may be tons of button with different functionalityies, i dont get why emergency is special and how it affects your design
Firstly thanks for the comment, it helps create the present and future videos better !!. if you see at 11:07, in the class diagram, there is a class for buttons and we extend from it to create inside and outside buttons. Do you mean somthing else
Thanks for your solution. Regarding the presentation, can't you just type stuff instead of handwriting, because latter looks super tedious for you and incomprehensible for viewers.
sorry for those scribbled text ! I was new to digital pens. But you are right , I would make sure the text are much cleaner/typed. Thanks a lot for the suggestion.