Time complexity | Space Complexity

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024

Комментарии • 29

  • @shubhamyache7867
    @shubhamyache7867 3 года назад

    What an explanation.. worderful 👏

  • @pranrv4983
    @pranrv4983 2 года назад

    You are a Gem

  • @akshatchawla-mg7tr
    @akshatchawla-mg7tr Год назад

    Thank you for the great explanation for time and space complexity please can you cover all the DS topics to make us understand in great way.. thank you once again

  • @chidanandamn1580
    @chidanandamn1580 3 года назад +4

    great explanation, for which scenario time complexity will be 0(nlogn)

    • @codewithsimran9899
      @codewithsimran9899  3 года назад +5

      If there are 2 loops nested where one has n complexity and another has logn it will get multipled and result to nlogn

    • @prajeeshprp941
      @prajeeshprp941 3 года назад +1

      @@codewithsimran9899 Thank you for the wonderful explanation.
      In this case, when combining O(n) with O(logn), instead of O(nlogn) why cant we say it is O(n). O(n) has a bigger time compared to O(logn)

    • @codewithsimran9899
      @codewithsimran9899  3 года назад +1

      When you're multiplying complexities they become one entity for example n log n is one entity and n^2 is one entity so we can't separate them out because they're nested and one piece of the program. However when we're adding n + log n that time first one task ran whose time complexity is n and then another task ran whose time complexity is log n so we treat them separately. So only while adding we consider one term.
      To conclude n + logn + nlogn will result to nlogn because that's the fastest growing.

    • @prajeeshprp941
      @prajeeshprp941 3 года назад

      @@codewithsimran9899 Okk I got it now! Thank you so much for your patience and support 🔥

  • @subhadipsur7561
    @subhadipsur7561 3 года назад +3

    Best explanation mam. Want a full series of DS and Algo.

  • @7u5h42
    @7u5h42 3 года назад +1

    Thanks, Mam! Awesome explanation

  • @shreyasb3403
    @shreyasb3403 3 года назад +1

    Very nice explanation of the concepts the. Concept of time complexity became very clear

  • @ItsSagarStyleee
    @ItsSagarStyleee 2 года назад

    Wow! Clear explanation and easy to understood in the video, thank you..

  • @shivashankar6043
    @shivashankar6043 3 года назад +2

    Want a video for space complexity

  • @shreyasjadhav6314
    @shreyasjadhav6314 2 года назад

    Please make a complete DSA series using js

  • @amanvishwakarma7847
    @amanvishwakarma7847 3 года назад +1

    Literally the best explanation mam 🧡

  • @prajeeshprp941
    @prajeeshprp941 3 года назад +2

    Thank you sooo much!!! This is lit 🔥 . Yes, we need maybe a short video too for space complexity. Like what if 1 extra variable is used, 2 extra variables is used, what if a temp variable declaration & initialization is inside a for loop for n items, is there a O(log n) for space complexity and also best practises

    • @codewithsimran9899
      @codewithsimran9899  3 года назад +2

      Thanks a lot. And if you're using extra variables that are not related to n for example 5 extra variables then we say we're using constant space only. But if you use extra space inside a for loop that runs from 0 to n and you're declaring a new variable everytime then space complexity is O(n) but if you're using same variable then you've declared only once even if it is inside for loop in that case it's O(1). Will let you know more details about log n :)

    • @prajeeshprp941
      @prajeeshprp941 3 года назад

      @@codewithsimran9899 Thank you for your quick reply!
      Please bear with here for this example. Let's say we have a need of a temporary variable inside a for a loop.
      So declaring and initializing a variable inside for loop is a bad practice?like
      let temp;
      for(){
      temp = something;
      //some operation with temp
      }
      or
      for(){
      let temp = something;
      //some operation with temp
      }
      which one is fine? declaring temp outside or inside? just to cross verify what we have discussed.

  • @kkdas7566
    @kkdas7566 3 года назад

    It's not enough to find time complexities.. It's very basic. So if you can add some complex problems it will be helpful

  • @sunnyparmar9692
    @sunnyparmar9692 3 года назад +1

    Awesome explanation and very helpful.. video on space complexity would be more than great!!!!!

  • @pratimhazarika4982
    @pratimhazarika4982 3 года назад +1

    So easily understood everything Mam 😁

  • @shaikhshahnawaz9883
    @shaikhshahnawaz9883 2 года назад

    Please make DSA in JavaScript video for placement (FAANG)

  • @SemicolonGuy
    @SemicolonGuy 3 года назад +1

    Great explanation. Can we Collab in a video? Both of our subscribers can learn something new then.

  • @rohit-2427
    @rohit-2427 3 года назад

    Js using ds??