System Design Rate Limiter | Sliding Window Implementation | System Design Interview

Поділитися
Вставка
  • Опубліковано 4 вер 2024

КОМЕНТАРІ • 10

  • @msingla135
    @msingla135 5 місяців тому +1

    I feel this is a better way of implementing the refresh method:
    private void refresh(long currTimeInSec) {
    long cutoffTime = currTimeInSec - windowInSecs;
    while(!window.isEmpty() && window.peek() < cutoffTime)
    window.poll();
    }

  • @yournextdoortraveller
    @yournextdoortraveller 2 роки тому +3

    Thanks for your video.
    One question. Do we actually need to calculate ''çalculatedTime' multiple time in while loop? Because the queue works on FIFO basis and if the top of the queue is expired for that sliding window isn't it the remaining entries of the queue also will be expired? Your thoughts please..

    • @devensingh5408
      @devensingh5408 Рік тому +1

      as you already mentioned the queue works as FIFO so the top of the queue is the oldest so time diff also will be greater and could exceed the defined limit, but the same could not be the case for the latest ones

  • @mehulparmar9976
    @mehulparmar9976 2 роки тому +1

    Can you also make a video on Sliding window with counters. Or atleast guide what will change in this code? Awesome video between.

    • @bhawanasahu3000
      @bhawanasahu3000 7 місяців тому

      To implement sliding with counter you can use map instead of queue. That would solve the requirement.

  • @aneksingh4496
    @aneksingh4496 2 роки тому +1

    Nice video

    • @TheTechGranth
      @TheTechGranth  2 роки тому

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

  • @mehulparmar9976
    @mehulparmar9976 2 роки тому

    Employee class is not present while building the code

  • @hassaantahir3861
    @hassaantahir3861 2 роки тому +1

    Bro BlaBlaCar system design ... Plz

    • @TheTechGranth
      @TheTechGranth  2 роки тому +1

      Basic idea will be like ola or uber, on top of this architecture you can add more functionality. Do check out this video and let me know if you are expecting something more
      ua-cam.com/video/AbvBcmABjcI/v-deo.html