Selling 2 parking spots - one upper level one lower level, prices vary per level, please message my only fans if interested
Пікірлер: 24
@priyanshubajpai6925 Жыл бұрын
I am enjoying your videos, thanks for sharing the knowledge! Content is crisp, delivery is consistent. So I don't need to change the playback speed often, which happens to be the case with many other channels!
@supritdk295615 күн бұрын
As already pointed by a couple other comments, when you add/ remove elements from priority queue, you would heapify which changes the index for the spot in underlying array. This would mean your hashmap goes out of sync not only for the element that is being inserted/deleted but in worst case for all the elements in the map. You would then have to construct the entire map again which I dont think is very good and negates the value provided by the priority queue. At this point you may as well do a linear search. Am I missing something here?
@jordanhasnolife516315 күн бұрын
Yep in retrospect something like a doubly linked list with hash map would have been better here.
@rvpandey99 Жыл бұрын
I come here after watching your video with Gaurav Sen doordash system design interview.
@sudhirdharmadhikari1938 Жыл бұрын
Nice ! Question. Wouldn't priority queue array index vary based on adding/removing of other vehicles in the queue ?
@jordanhasnolife5163 Жыл бұрын
Yeah you'll just have to change that hash entry 😭, it doesn't change time complexity
@Rakeshkumar-po2yg11 ай бұрын
@jordan Can you please elaborate more on parkingSpotHashMap and pQueues ? How these are defined .
@jordanhasnolife516311 ай бұрын
I think the main point to realize is from each entry certain spots are more preferable, hence we need a priority queue to represent this. However there are multiple entrances, and each one is at a different location in the lot, so the rankings of spotsos different for each entrance, meaning we may want multiple different priority queues, one per entrance. Unfortunately, this means that we need to keep them in sync - to do that a hash map that points from a spot in a pqueue to the corresponding spots in the other pqueues allow us to quickly find and remove the corresponding nodes when a single spot is taken up.
@Rakeshkumar-po2yg11 ай бұрын
@@jordanhasnolife5163 hey Jordan thanks for your prompt reply.
@priyanshubajpai6925 Жыл бұрын
enter method would also need to remove the 'location in p_queue' from parkingSportHashMap? or is it redundant?
@jordanhasnolife5163 Жыл бұрын
That seems fair to me, though I'm not sure it's entirely necessary
@amen6525 ай бұрын
Yo Jordan, I have a OOP type technical interview coming up. Been watching through your videos. Do you have any resources you could point me to that helped you with breaking down these problems, etc? (I like men)
@jordanhasnolife51635 ай бұрын
Thanks for specifying that you like men at the end there, that helps. No specific resources, I think you should just try to search for the types of problems that get asked in these interviews, come up with your own solution, and then if you're struggling look up solutions online. Then from there iterate and look to apply what you learned!
@Rakeshkumar-po2yg11 ай бұрын
Hey @jordanhasnolife5163 I had a interview where I need to design a way where two screen are connected to each other (like a video wall Screens) and when we press "ON" button on remote controller both the screens will be turned on and when we press "OFF" button both will be turned of. Can we do with the help of sockets or if you can suggest a way to do so? Please help me.
@jordanhasnolife516311 ай бұрын
Is this a LLD or systems design question? If the latter than sure websockets work
@huazhou26 ай бұрын
@9:54, wouldn’t add element into min heap also change the index of array? i.e. the value in the hashmap?
@jordanhasnolife51636 ай бұрын
Yes good point, you can just build the heap first and then add in the hash-map.
@huazhou26 ай бұрын
Thanks@@jordanhasnolife5163! but the idea of using hashmap is to reduce time complexity for deleting/adding element from minheap, each element deletion or addition to the minheap will change like half branch's elements' indices (the worst case), and the deleting element from minheap is always o(logn) even if using a hashmap as a byside data structure (in this case, we also need to update hashmap whenever there's entry or exit of car, which increases time complexity), what do you think a way to reduce complexity for manipulating minheap in this case?
@priyanshubajpai6925 Жыл бұрын
ig you put EXIT_NUMBER as a parameter in the method signature instead of the entrance_number
@jordanhasnolife5163 Жыл бұрын
Yup nice catch
@zuowang51852 ай бұрын
Typical parking lot doesn’t assign spot
@jordanhasnolife51632 ай бұрын
Correct but then this problem wouldn't be worth doing. You'd just enter lol