Design an Elevator System | Systems Design Interview question |

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025

ความคิดเห็น • 40

  • @warnercooler4488
    @warnercooler4488 3 ปีที่แล้ว +3

    Nice explanation of the algorithm. Thank you so much!

  • @TheSudh123456
    @TheSudh123456 2 ปีที่แล้ว +1

    awesome explanation. Insightful.

  • @seemapatel1333
    @seemapatel1333 2 ปีที่แล้ว +1

    Very well explained . Thank you so much !

  • @sakshamjain1005
    @sakshamjain1005 ปีที่แล้ว +4

    MinHeap update operation is quite costly since its getting updated at every move of lift in either direction O(NLog(N)) to be precise

    • @TheSubsonicOne
      @TheSubsonicOne ปีที่แล้ว +2

      It's an ELEVATOR. It only has so many floors. Unless it's being implemented by actual snails, or a 1HZ processor, I think it will be fine.

  • @sravanchaitanya7372
    @sravanchaitanya7372 7 หลายเดือนก่อน

    very well explained thankyou for your time.

  • @manus7342
    @manus7342 3 ปีที่แล้ว +3

    Very well explained. Please make more OOD videos

    • @codeTreeMS
      @codeTreeMS  3 ปีที่แล้ว +2

      Thanks ! Will get back to making more such vidoes soon.

    • @manus7342
      @manus7342 3 ปีที่แล้ว

      @@codeTreeMS Thanks :)

  • @HimalayaGarg
    @HimalayaGarg 2 ปีที่แล้ว +1

    Should change the distance in heap when lift is moving

  • @arunavasaha7051
    @arunavasaha7051 ปีที่แล้ว +3

    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?

    • @AnkitYadav-up4
      @AnkitYadav-up4 4 หลายเดือนก่อน

      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

  • @billfang2666
    @billfang2666 3 ปีที่แล้ว +1

    I like the video because it is succinct and explained well.

  • @dezediok2451
    @dezediok2451 ปีที่แล้ว

    Is there a particular design pattern that you implemented for the UML class diagram? If so what is that pattern called?

  • @ameyjain3462
    @ameyjain3462 3 ปีที่แล้ว +3

    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

    • @codeTreeMS
      @codeTreeMS  3 ปีที่แล้ว

      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

  • @misterdonaldduck
    @misterdonaldduck 7 หลายเดือนก่อน +1

    What does the orange diamond mean?

  • @nandanapuameer4693
    @nandanapuameer4693 3 ปีที่แล้ว +1

    which tool are you using to design this

  • @AyushKumar-yn3xb
    @AyushKumar-yn3xb 2 ปีที่แล้ว

    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.

    • @karthikairam
      @karthikairam ปีที่แล้ว

      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.

  • @shashankmishra484
    @shashankmishra484 2 ปีที่แล้ว

    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

    • @codeTreeMS
      @codeTreeMS  2 ปีที่แล้ว +1

      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.

  • @mojolu1126
    @mojolu1126 2 ปีที่แล้ว +1

    isn't there a relationship from door to car? 18:14

    • @jasiuskwarczek
      @jasiuskwarczek 2 ปีที่แล้ว +1

      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

  • @learnwithme7750
    @learnwithme7750 ปีที่แล้ว

    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?

    • @codeTreeMS
      @codeTreeMS  ปีที่แล้ว

      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.

    • @learnwithme7750
      @learnwithme7750 ปีที่แล้ว

      @@codeTreeMS ok thanks!

  • @mohitrathore8808
    @mohitrathore8808 ปีที่แล้ว

    Please add timestamps :), btw nice video

  • @jbbanerjee8534
    @jbbanerjee8534 3 ปีที่แล้ว +1

    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 .

    • @codeTreeMS
      @codeTreeMS  3 ปีที่แล้ว

      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.

    • @PeskyTheWabbit
      @PeskyTheWabbit 2 ปีที่แล้ว

      @@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

  • @aseem30
    @aseem30 ปีที่แล้ว

    Any interviewer is going to ask why you picked up min heap of all the data structures.

    • @codeTreeMS
      @codeTreeMS  ปีที่แล้ว

      Thats a resonable question and had a resonable answer, time complexity. in O(1) you can get the closest person to the elevator.

  • @anilchaudhry804
    @anilchaudhry804 2 ปีที่แล้ว

    code in java?

  • @sokachinnarao7694
    @sokachinnarao7694 2 ปีที่แล้ว

    Sir, one small doubt, how many elevators are required in buildings

    • @codeTreeMS
      @codeTreeMS  2 ปีที่แล้ว

      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.

  • @abhishekmudaliyar5361
    @abhishekmudaliyar5361 11 หลายเดือนก่อน

    Bro code please

  • @mojolu1126
    @mojolu1126 2 ปีที่แล้ว

    16:09 you spelled elevator wrong

  • @anshulchauhan6738
    @anshulchauhan6738 ปีที่แล้ว

    Looks like the copy of Educative design

    • @anthonya880
      @anthonya880 2 หลายเดือนก่อน

      Is d course on educative good ?