Asymptotic Analysis (Solved Problem 1)

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

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

  • @aryamantodkar3716
    @aryamantodkar3716 3 года назад +182

    I checked out 2-3 courses on data structures but felt that they’re not explaining concepts properly but the way you explain is amazing👌🏻

  • @ujwalapatil650
    @ujwalapatil650 4 года назад +104

    Teaching is very excellent👏👏👏.
    Answer is O(n^2 logn).

  • @manikumartharmaraj2333
    @manikumartharmaraj2333 4 года назад +536

    Answer for Homework Problem is O(n^2 logn)

    • @cp65143
      @cp65143 3 года назад +23

      1st for loop O[n]
      2nd for loop O[logn]
      3rd for loop O [n]

    • @thirumal1086
      @thirumal1086 3 года назад +21

      the loop parameter in 2nd loop is not changing

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

      @@thirumal1086 whats the correct answer then?

    • @FaAbYorker
      @FaAbYorker 3 года назад +28

      @@hetaeramancer the problem is same as the previous one shown in the tutorial, just changed the log loop order. However, finally we need to multiply it, so we the answer O(n)×O(logn)×O(n)= O(n²logn)

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

      @@FaAbYorker the second loop isn't updating tho

  • @008abhishekvishwakarma9
    @008abhishekvishwakarma9 3 года назад +70

    I check my answer in the comments but what I see everyone is thanking neso academy. I thank them too to give us these precious video lectures 🙏

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

      Yes please im also searching for the answers to verify. I think it would be better if @ neso academy provides the answers. However the work done by neso is absolutely awesome.

    • @workwiseonline
      @workwiseonline Год назад +6

      @@charankumar4267 The time complexity of nested loops can be determined by analyzing the number of iterations each loop performs.
      Let's break down the given nested loops:
      ```
      for (i = n/2; i

    • @emirsaidhaliloglu2523
      @emirsaidhaliloglu2523 8 месяцев назад +1

      @@workwiseonline the log should be in base 2 in the final answer right?

    • @workwiseonline
      @workwiseonline 8 месяцев назад +1

      Right

    • @emirsaidhaliloglu2523
      @emirsaidhaliloglu2523 8 месяцев назад +1

      @@workwiseonline thanks for the fast reply

  • @sharuhasans9417
    @sharuhasans9417 4 года назад +24

    solve many problems in time complexity which are often used in programs it will be helpful and thank you no other video in youtube has this much clear explanation

  • @joysaha3927
    @joysaha3927 2 года назад +126

    I think in the homework problem, there is a mistake! It maybe be j=2*j.
    Otherwise, for 2*j, It will go into an infinite loop and therefore, there is no "algorithm time complexity" for an infinite loop.
    for j=2*j, The time complexity is O(logn). So the answer is: O(n^2logn)

    • @piyushpadhan2477
      @piyushpadhan2477 Год назад +1

      Yes bro

    • @mfahmifachrozi2728
      @mfahmifachrozi2728 Год назад

      it's O(n^logn*n) isn't it? cmiiw

    • @redtree732
      @redtree732 Год назад +3

      I got O(n^2 * log(n)) as well.

    • @yenthlydevolder7076
      @yenthlydevolder7076 10 месяцев назад

      ye but thats the same as O(n² log(n)) @@mfahmifachrozi2728

    • @AyushKumarYadav-j7i
      @AyushKumarYadav-j7i Месяц назад

      It will not go in infinite loop when after p iterations 2^p-1 = n, then the loop will stop. Answer is O(n²logn)

  • @sergion_brayen
    @sergion_brayen Год назад +15

    after going through 3 to 4 dsa playlist on youtube undoubtly i can say that this is the best dsa playlist available in youtube , thanks neso academy for this wonderful explanation

  • @venkateshsharma2680
    @venkateshsharma2680 4 года назад +50

    I stick to your content from starting till end.Excellent way of teaching.

    • @danishimwe278
      @danishimwe278 2 года назад +1

      even me, he is an excellent at teaching and explaining things!!

  • @kunalsoni7681
    @kunalsoni7681 4 года назад +25

    This video is very most important for competitive programming..
    😇😊 Great emplanation for time complexity

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

      hi, your answer give me a question for you, so why this topic of exercises is most important for competitive programming?

    • @abdullahansari6696
      @abdullahansari6696 2 месяца назад

      @@manuelconte623 its simple....becuase Its the most basic foundation of programming complexity in accordance with memory, time and everything.....programming is not only about programming but also with these things....hope you understood...

  • @balghar493
    @balghar493 2 года назад +10

    I must say this is a really nice intro to Asymptotic Analysis thank you, saved me a lot of headache

  • @SidTheBot
    @SidTheBot 3 года назад +30

    Thanks for the awesome explanation😍😍
    hey, Neso in the homework problem the loop for( j=1; j

  • @tierasmith4860
    @tierasmith4860 Год назад +6

    thank god for youtube, my prof went through this and it’s on the final next week. i was so confused but you cleared it up!

  • @hichamlaqrafi2885
    @hichamlaqrafi2885 4 года назад +21

    the answer is O(n² log n) Great work ♥ I appreciate your effort

    • @kirtitung4877
      @kirtitung4877 4 года назад +2

      This should be O(n^2)
      Since 2nd loop is constant time complexity .
      I am talking about homework problems

    • @hichamlaqrafi2885
      @hichamlaqrafi2885 4 года назад +6

      @@kirtitung4877 No, because we have 3 nested loops for the first one is O(n) and the second one is O(log n) then the last one is O(n) so the answer is O(n×log n×n)=O(n² log n)

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

      Correct

    • @aravindks7636
      @aravindks7636 4 года назад

      O(nxnxlogn)=O(n²logn) try to figure out what happens inside the loops..

  • @Shivshar-f4r
    @Shivshar-f4r 10 месяцев назад +3

    1st loop = O(n)
    2nd loop = O(logn) , base 2
    3rd loop = O(n)
    Answer =O (n^2 logn)

  • @jaydomadia9182
    @jaydomadia9182 4 года назад +12

    Solution of HW problem is: upper bound is infinite.
    Since there is no modification in j value.
    J always remains 1 and if n>1 then second for loop would be executing infinitely.
    J is just multiplied by 2. Not assigned to j again.

  • @kashif3173
    @kashif3173 2 года назад +7

    Sir I got Time complexity as ----------> (n^(2)) Log(n), if consider j = j*2 in 2nd for loop
    Please confirm it.

  • @sanjaikumar7201
    @sanjaikumar7201 3 дня назад

    As same as everyone saying, I like the way and content you teach for us. Thank you very much.
    Answer is O(n^2 logn)

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

    I found a best explanation of calculating time complexity here.THANKS #nesoacademy

  • @anugrahmasih6347
    @anugrahmasih6347 3 года назад +7

    Answer for homework problem is O(n^2 log n to the base 2)

  • @parizadas
    @parizadas 4 года назад +7

    All the videos are amazing. Thankyou so much.

  • @CSstudent_1001
    @CSstudent_1001 Год назад +2

    1st loop : O(n)
    2nd loop: O(log2n)
    last loop: O(n)
    So the total time complexity is
    O(n^2 log n)

  • @manishshee6990
    @manishshee6990 4 года назад +2

    The Answer is O(n^2 log(n)).....
    Nice those videos on time complexity
    And Also I want to the videos of space Complexity

  • @workwiseonline
    @workwiseonline Год назад +5

    The time complexity of nested loops can be determined by analyzing the number of iterations each loop performs.
    Let's break down the given nested loops:
    ```
    for (i = n/2; i

  • @aashutoshmurthy
    @aashutoshmurthy 4 года назад +11

    I have a doubt. Many of them are saying the answer to the Homework problem as O(n^2 * log2(n)), but in the second for loop, there is no update statement. 2*j isn't updating the value of j, which makes j constant and hence, the for loop becomes an infinite loop. Isn't time complexity O (Infinity)?

    • @Rest_leave
      @Rest_leave 4 года назад

      you are right bro

    • @hemanthb4525
      @hemanthb4525 4 года назад

      yes bro i got same only

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

      so time xomplexity is n^2 ??

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

      @@hetaeramancer No, as I said, the time complexity is O(∞).

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

      case one, n= 0, and case 2 n >=1. case one O(1), case two there is no algorithmic complexity, algorithm much terminates.

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

    I am hopeful that..... This is the best content..,..... When I search the entire RUclips channels for data structures

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

    Jasprit sir's way of teaching is over powered

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

    Best way of teaching 🥳🥳
    Answer ,0(n^2logn)

  • @nishulpatni7728
    @nishulpatni7728 4 года назад +22

    this is quality education #naso_acadmey

  • @gauravkale6738
    @gauravkale6738 4 года назад +19

    The answer is: O(n^2log2). Thanks for explaining #nesoacademy

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

    Here third loop will take 2N unit time because there is count statement
    If loop run 2 times then count++ also 2 times here total 4 unit of time is consumed and if last loop run 3 times count++ also run 3 times so here 6 unit of time is consumed so 2*N unit of time is consumed in last loop
    n/2×logn×2n=n^2(logn or log2n) i think this the way

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

    There is some mistake in 2nd loop(Home work problem) .. it will be -> for(j=1 ; j

  • @abdishakur2489
    @abdishakur2489 4 года назад +11

    Great contents, loved it 😍

  • @48_prasenjitmondal6
    @48_prasenjitmondal6 4 года назад +6

    O(n^2logn) may be the answer of today's question.Thank you #nesoacademy

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

    Superb sir all of ur videos in each subject are awesome

  • @yenzyhebron5278
    @yenzyhebron5278 3 года назад +21

    Sir Neso at the 2nd for loop of the homework problem, the loop control variable j does not get updated simply with 2*j
    You must mean j *= 2 or j = 2*j. Nonetheless, great lecture as always.

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

    I think the answer will be O(infinite)
    Because in the second for loop the value of j is not incrementing so one the program enters the second for loop then the for loop condition will never get wrong and hence it will keep running

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

      infinite loop has no algorithmic time complexity actually for some algo's it is also possible that we cannot find the time complexity

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

    Great content... really cleared my doubts....
    Thanks for this video

  • @RAHULKUMAR-cw3gq
    @RAHULKUMAR-cw3gq 3 года назад +3

    Best teacher ever..❤️

  • @POSITIVITYPREP
    @POSITIVITYPREP 10 месяцев назад

    If we consider above same code then the time complexity would be O(n^3 ) as most of you confused in 2nd loop that there is mistake i don't think so like if there is not written j=j×2 its written j×2 this means the value of j is incrementing by double of its value like the time complexity of this will calculated by 1+2(k-1) =n so its will be N/2

  • @pratikkumar9696
    @pratikkumar9696 4 года назад +7

    Answer for homework problem is - - it will give TLE (time limit exceed) because 2nd loop runs infinite number of times

    • @lavisharora3655
      @lavisharora3655 4 года назад +1

      It will sow error , as it is not a valid statement.

    • @pushkarajyeolekar5852
      @pushkarajyeolekar5852 4 года назад +1

      Can you explain how the loop goes on infinity?

    • @pratikkumar9696
      @pratikkumar9696 4 года назад

      @@pushkarajyeolekar5852 see in 2nd for loop
      Value of j is 1 and we are not incrementing its value and value of j is always 1

    • @derekking4188
      @derekking4188 4 года назад +1

      @@pratikkumar9696 j*2 //it is changing j value when 2nd loop runs for another time j would become j*2 i.e 2

    • @derekking4188
      @derekking4188 4 года назад

      and so on

  • @AfnanAl-Nuzaili
    @AfnanAl-Nuzaili 2 года назад +1

    The Best academy ever

  • @ShivaniSingh-jt6kl
    @ShivaniSingh-jt6kl 4 года назад +2

    Thank you! For these! A big help. Kindly please post more vidoes in this playlist as it is not complete

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

    Home work, we can consider two cases, one where input is less than one that and input greater than one. less than one the growth rate is O(n), but if its n>= n. the algorithm fails and there is no defined time complexity.

  • @lokeshwaraachari6781
    @lokeshwaraachari6781 Год назад

    Good explanation.....neso academy always best👍

  • @Josue-Arreaga
    @Josue-Arreaga Год назад +1

    Beautiful analysis! Incredible job. Thank you for providing this content.

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

    Thanks Neso Academy, you are really helping us better understanding our lectures.

  • @Sahil-explorer
    @Sahil-explorer 4 года назад +5

    Sir upload more videos daily if u can.maybe 3 or more per day if possible.

  • @abhilash486
    @abhilash486 Год назад +1

    answer is O(n2 log n) is it correct jaspreet sir

  • @63muhammadumair5
    @63muhammadumair5 3 года назад +1

    Love you sir ❤️

  • @sudheerjalli4707
    @sudheerjalli4707 4 года назад +1

    O(n*logn base 2 * n)

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

    In given homework problem, loop for variable j goes into infinite loop. but if j = 2*j in inc expression, then answer is as expected.

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

      But lets say j has address 1000, and if j is 1 initially and then multiplied by 2, the answer will be stored in same address, not a different one so it is assigned,,,,correct me if i am wrong

    • @user-wx8rg9wc7r
      @user-wx8rg9wc7r 2 года назад

      @@nisharathod2945 answer will not get stored without assignment operator, in case of above problem it should throw an error

  • @shivangisingh1608
    @shivangisingh1608 9 месяцев назад

    First loop-O(n)
    Second loop-O(log n)
    Third loop-O(n)
    Final Answer=O(n^2 . log n)

  • @yogeshbmyogeshbm5154
    @yogeshbmyogeshbm5154 4 года назад +1

    Hey hi senior. Here why we can't take n/2 instead of 'n' while considering the last term of the for loop ( where we have took o(n) )

    • @atulmishra2593
      @atulmishra2593 4 года назад +1

      Because Big-O-notation refer to the worst case complexity I.e. upper bound .
      Got it

    • @yogeshbmyogeshbm5154
      @yogeshbmyogeshbm5154 4 года назад

      @@atulmishra2593 thank u..

  • @ollicron7397
    @ollicron7397 Год назад

    I LOVE how you went through this thank you so much.

  • @MuhammadHassan-w1l
    @MuhammadHassan-w1l 2 месяца назад

    realy first time i got the point

  • @GouniyaminiReddy
    @GouniyaminiReddy Год назад +1

    homework problem time complexity is O(n^2logn)

  • @Lekx-na
    @Lekx-na 6 месяцев назад

    Thanks for saving my life

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

    (n^2 logn)
    Great Explanation

  • @vinodbujji7951
    @vinodbujji7951 4 года назад +2

    Sir what is the right answer ?I got O(n^3) if it is O(n^2.logn) please explain

  • @harshkumarjha1931
    @harshkumarjha1931 4 года назад +1

    Thank you for this course. But how much time it will take to complete this ds course

  • @ritikthakur6270
    @ritikthakur6270 4 года назад +5

    Sir in this list of data structure please cover the advance part of data structure also

  • @jlau04
    @jlau04 Год назад

    So essentially we solve for the variable representing the iteration number each time and use that to find the upper bound?

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

    dayum nice explanation

  • @abeltadesse9291
    @abeltadesse9291 Год назад

    Always Neso Acadamy

  • @arvindynr
    @arvindynr 23 дня назад

    This is infinite loop. the first condition i

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

    home work's question's total time complexity is O(n^2 logn)

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

    Thank you for making this presentation

  • @sheroocodingacademy
    @sheroocodingacademy 8 месяцев назад

    I wanted to ask that in the last loop why are we considering its time complexity as O(n) instead of taking upper bound of n?

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

    Thank you Sir...

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

    I love you Neso Academy. ❤️

  • @nafishanika26
    @nafishanika26 11 месяцев назад

    keep up the good work!! this video was so much helpful, thank you soo much!

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

    Answer is O(n^2logn)
    Thank you sir. My concepts are now very clear.😊

  • @RohitKumar-dv7bw
    @RohitKumar-dv7bw 4 года назад +1

    Thanks a lot #nesoacademy for making this time complexity session very easy to understand

  • @CSstudent_1001
    @CSstudent_1001 Год назад

    Good explanation 👏

  • @kumarlankalapalli3533
    @kumarlankalapalli3533 Месяц назад

    O(n^2logn with base2)

  • @anujpatel2121
    @anujpatel2121 9 месяцев назад

    Great explanation! 🤟

  • @alihameed7865
    @alihameed7865 4 года назад +2

    the answer is O(n^2 log n base 2)

  • @JestinGigi
    @JestinGigi Год назад

    Thanks a lot !! cleared all my concepts

  • @michaelaladejobi
    @michaelaladejobi 9 месяцев назад

    O(n^2 log(base2) of n)

  • @richarddjirackor2650
    @richarddjirackor2650 Месяц назад

    Thank you

  • @biswajitrout4710
    @biswajitrout4710 4 года назад +1

    Nice work sir ur videos are really good .

  • @RandhirkumarK-IT-
    @RandhirkumarK-IT- 3 года назад +1

    The answer for the H.W problem is O(n*logn*logn)

  • @funnyhell14321
    @funnyhell14321 4 года назад +5

    Sir! Please post DBMS tutorial for beginners 🙏🏻

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

    thanks for such amazing content sir!..one doubt ..that when we declare a function or rather initialize a function....how do we account for the time complexity of that?

  • @RownakIkram
    @RownakIkram Год назад

    Best Sir

  • @sagarraj6354
    @sagarraj6354 4 года назад +2

    O(n'2 log2_n).... Thank u..

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

    The time complexity you have calculated is for worst case right?

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

    n square multiply by logn is total time complexity

  • @arunkumar-xu8nr
    @arunkumar-xu8nr 4 года назад +2

    Sir,How many more lectures are there to complete the subject ?

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

    Home Work: O(n^2 logn)

  • @MadhuKM-b8o
    @MadhuKM-b8o Месяц назад

    TOTAL TIME = O(1) +O(n)+O(logn)+O(n)=O(n^2 logn)................

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

    answer of the homework=> n * logn * n == O(n^2 logn)

  • @JONATHANFARRELEMANUEL
    @JONATHANFARRELEMANUEL Год назад

    thanks a lot🙏🙏🙏🙏 very helpful

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

    you have such a nice voice🥰

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

    Answer of Homework problem = O(n^2logn)

  • @derekking4188
    @derekking4188 4 года назад

    Answer>> O(n^2 logn)

  • @techknow97
    @techknow97 7 месяцев назад

    for (int i = 1; i

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

    Too good bro....... 👍

  • @daiyaanmuhammadfardeen1607
    @daiyaanmuhammadfardeen1607 Год назад

    The complexity of the snippet at the end should be infinite. Because even for k=infinite, j = 1

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

    Thank you so much