Elevator Low Level System Design | Object Oriented Design | Elevator Algorithm

Ғылым және технология

System Design | #SystemDesign :
Elevator low level system design is a common Object oriented system design problem which is asked in interviews of big tech companies like FAANG.
The over all design is simple if you consider a single elevator car but complexity increases as you add multiple elevators.
Over LLD is simple, the complex part is the algorithm for the dispatcher or scheduler unit of the elevator.
In most tech companies you might be asked just to describe the various algorithms as it might get really complicated to actually write the complete code for the scheduler in the limited time.
You might be asked to write a sudo code for one of the algorithm to check knowledge on DS and algo concept.
Here is the code for SCAN/Elevator algorithm from geeksforgeeks:
www.geeksforgeeks.org/scan-el...
You can buy us a coffee at : www.buymeacoffee.com/thetechg...
system design(HLD & LLD): • System Design | Distri...
DS for beginners: • Arrays Data Structures...
leetcode solutions: • Leetcode 84 | Largest ...
github: github.com/TheTechGranth/theg...
facebook group : / 741317603336313
twitter: / granthtech

Пікірлер: 32

  • @rabindrakumar949
    @rabindrakumar9492 жыл бұрын

    In low level design you wrote most of the things as document oriented paragraph. It would be great if you write some algo kind of code. Where you used your defined class, inheritance, composition, design patterns.

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    Can you check the videos in design pattern playlist, I think that is what you are asking for, if i am not wrong 🙂

  • @rabindrakumar949

    @rabindrakumar949

    2 жыл бұрын

    @@TheTechGranth it may be present a chapter in design pattern. But the ask is how you implement design patterns in low level design algorithms. Anyone can write singleton design pattern but how to make sure that the problem statement may need this during the solution.

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    @@rabindrakumar949 got your point 🙂 thanks for the suggestion, planning for a logger lld will try to include this suggestion in that 🙂

  • @stealthrabbi9064
    @stealthrabbi90642 жыл бұрын

    Thanks for the video. The scan method makes sense for if you have a single elevator. If you have multiple elevators, some int he up state, and some in the down state, how do you choose which elevator services the request? The dispatcher needs to know which elevator is closest to the a given request, but then how do you determinte a new request's priority, since priorties for a job are different per elevator depending on their state. Does the dispatcher just give out the next job to the elevator when it finishes its current job? If you have 2 elevators on floor 1, and you have requests to go Up on floors 2, 3, 4, 5, 6, 7, then do you send elevator 1 to floor 2, and elevator 2 to floor 3, and just get the next job whenever the one finishes? I guess you don't know how long it will take for the car to load / unload to predict out in the future. There's also some consideration for duplicate jobs. Like if the car makes a request to move from floor 2 to 3, and a floor panel makes a request to move Up, those two requests basically overlap / are the same, so a given action could fufill more than 1 request, so there's some consideration there as well.

  • @mohamedfares7135

    @mohamedfares7135

    Жыл бұрын

    I have been thinking about this for days and it fried my brain. As far as I know, it has to be multi threaded but I cannot pinpoint what the threads will be and if there are any mutex. And none of the videos talk about this. I am glad that someone was thinking about it the same way I do ✌️

  • @prabinpanda2882
    @prabinpanda28822 жыл бұрын

    Very nice explanation, and unique

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    Hope it was helpful. Do like and subscribe and share with others 🙂

  • @priyankarrajgupta4198
    @priyankarrajgupta41982 жыл бұрын

    hey, what happens when we want to go from floor 15 to floor 35. according to ur zone method can we do it ?

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    This was just a sample example, you need to have overlapping floors for different elevator systems

  • @Paradise-kv7fn
    @Paradise-kv7fn2 жыл бұрын

    Instead of isMoving & isMovingUp, I think it would be better to just use an enum - Status(UP, DOWN, IDLE)

  • @manishkumar-qn6lx

    @manishkumar-qn6lx

    Жыл бұрын

    I'm going to comment the same!

  • @3dlove100
    @3dlove1002 жыл бұрын

    Really Liked the explanation..!! Just a thought can you add the kind of data structures like (HashMap, Set , Vector .....) to use here .. when we implement the door panel , button panel .. etcc... In that way it will be more knowledgeable ..

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    Complete implementation is though to provide in 20-30 min video, planning to come up with the code for Job scheduler which can be used here as well. Not getting time for it currently 😀

  • @3dlove100

    @3dlove100

    2 жыл бұрын

    @@TheTechGranth That's great. Do it whenever you have time. I was targeting those audience, who are beginners in data structure , for them it will be efficient.

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    @@3dlove100 will come up with DSA course as well in future ;) I have a small very basic level course for now, for those who wants to start coding and learn DSA : kzread.info/head/PLJN9ydlFnJsiGBEhtBTL6Fj_2yxQFhYhS

  • @prateekdiliphalwe2537
    @prateekdiliphalwe25373 жыл бұрын

    Shouldn't Elevator system (the main one with list of floors and elevators) have an object of a Dispatcher Unit?

  • @TheTechGranth

    @TheTechGranth

    3 жыл бұрын

    Implemention of button panel will have that object as per this design, which seemed reasonable to me as elevator in itself does not need a dispatcher, it is the action of button which needs it.

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd3 жыл бұрын

    Can you suggest some books on LLD and also I think in LLD we need to implement the DEsign patterns and SOLID principles but that seems to be missin in it. Please make a video on LLD implementing design patterns and solid principles. Also do we need to write code or just the class diagrams only??

  • @TheTechGranth

    @TheTechGranth

    3 жыл бұрын

    Design principles have been considered in almost all the videos that I have i added, my mistake I did not explain them as I thought they were understood. For patterns in many cases you might not be able to implement an exact pattern which is commonly used but if you are able to relate them then it is good. in most cases if you end up breaking a class properly and come up with good solid interfaces, you are by default using Strategy pattern, for eg. ButtonPanel in here. In most of the interview as per my experience, class diagram/ apis are good enough. In few cases you might be asked to implement few methods like in case of snake and ladder or tic tac toe kind of problem. Please understand, interviewer ask you to write code to test your problem solving skills and in general you always have some interview rounds just for that where you are asked competitive programming questions. for design patterns I have found Head First design pattern book as a good source of knowledge

  • @ChandraShekhar-by3cd

    @ChandraShekhar-by3cd

    3 жыл бұрын

    @@TheTechGranth Thanks a lot for your reply and suggestion in this topic. Please upload a separte video on design pattern and solid principle because we needed a clear idea aboout how to implement it in real coding interview. Thanks a lot for your hard work and time for making this community a better place.

  • @TheTechGranth

    @TheTechGranth

    3 жыл бұрын

    @@ChandraShekhar-by3cd Yes would come up with these videos as well. Thanks for watching. Hope these videos are helping you. Do like and share with your friends as well, it motivates a lot!!!

  • @huesenpaul1394

    @huesenpaul1394

    3 жыл бұрын

    @@TheTechGranth do you know any good elevator engineering books ?

  • @TheTechGranth

    @TheTechGranth

    3 жыл бұрын

    @@huesenpaul1394 do you mean the one with plc programming or similar programming?

  • @manaswitadatta
    @manaswitadatta2 жыл бұрын

    16:36 lol

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    :D :D Good Catch

  • @cosmicazur
    @cosmicazur2 жыл бұрын

    What's an elevator "car"? Why is it called a car?

  • @TheTechGranth

    @TheTechGranth

    2 жыл бұрын

    Wikipedia has an interesting answer for this 🙂 en.m.wikipedia.org/wiki/Elevator

Келесі