Time complexity analysis - some general rules

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

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

  • @GlassesAndCoffeeMugs
    @GlassesAndCoffeeMugs 3 года назад +117

    6 years later and this is still the most clear and concise explanation I've seen

  • @saxenaakash19
    @saxenaakash19 6 лет назад +87

    A) Drop lower order terms
    B) Drop the multiplier
    C) Total running time is sum of fragments. For large input sizes the the run time depends upon the fragment with highest run time
    D) If there are two cases possible the time complexity depends upon the worst case scenario (the one with largest time complexity)

  • @tombranson9341
    @tombranson9341 6 лет назад +6

    I am in grad school for software engineering and love to program. I've seen a lot of channels, many good ones, but yours is one of the absolute best. I come back to your videos to refresh and learn, pick up stuff that went over my head the first time around.

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

    The only and only explanation that helped me understand this analysis. Really thankful for the effort you put into making these videos.

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

    This tutorial video was so well explained. Suddenly entire concept is looking so simple!

  • @RafaelCamposNunes
    @RafaelCamposNunes 10 лет назад +31

    You should explain the Theta and the Omega general rules as well, it would be awesome, finally I understand how to calculate Time Complexity with your videos. :D

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

    seeing comments from 4, 5, 6 , 7 years ago is so eerie it gives me chills...

  • @abuenavi
    @abuenavi 9 лет назад +2

    Your explanations are some of the best CS videos I have found anywhere, including videos from universities! Your channel has a lot of videos, some idea of which playlists and videos to start with and what to watch next would be great. Great job!

  • @ShubhamSingh-de8es
    @ShubhamSingh-de8es 3 года назад +2

    Most Clear and Concise Explanation.

  • @sumitchavan9587
    @sumitchavan9587 8 лет назад

    This channel is PURE GOLD!!

  • @UriYakir
    @UriYakir 11 лет назад +47

    Thank you so much!!! I barely understood the topic and your video made it all clear for me! If I could, I would have given you a thousand likes! :)

    • @mycodeschool
      @mycodeschool  11 лет назад +4

      Thanks Uri Yakir

    • @AbhimanyuAryan
      @AbhimanyuAryan 10 лет назад +1

      1 dislike lets find that bastard :(

    • @pond.filler-4503
      @pond.filler-4503 8 лет назад

      +BomBamBum for the first question, the runtime should be log n. for the second question, the runtime should be n log n

    • @cyberpunk7702
      @cyberpunk7702 8 лет назад +1

      +Pond. Filler- may I ask how did you get log(n) for the first question?

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

      so what's up with life now champ, what did you do ?

  • @cafafans
    @cafafans 5 лет назад

    The best video on the entire web about Time Complexity.

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

    Please do the complete series on design and analysis of algorithms. You are the best teacher I have ever encountered on RUclips.

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

      He's no more

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

      @@aayush5474 stupid, this guy is very much alive, and working at Google US. The other co-founder of the channel passed away in a car accident.

  • @laylab5195
    @laylab5195 7 лет назад +1

    you are my savior!!! I couldn't have passed any of my classes without you.
    please tell me you continued this series somewhere ???

  • @TheAnimeotaku2k
    @TheAnimeotaku2k 5 лет назад

    Thank you for making this video! I am currently taking an algorithms class and this part of the class is giving me the most trouble in understanding the time complexity of the code. Your guidance of this topic makes things so much simpler to understand.

  • @cyberfiles8076
    @cyberfiles8076 6 лет назад

    Thank you for your clear explanations. Good teachers and tutorials are rare enough.

  • @dedadev8756
    @dedadev8756 5 лет назад

    The only video you needed for this series

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

    Thank you for the extremely precise and accurate video. 45 lecture videos and this still somehow manages to explain it better, more efficiently and in simpler terms

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

      there are only 4 videos right??

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

      @@hemantborse8923 yes I was implying that my lessons tried to cover something similar in over 45 lecture hours where they still didn't succeed

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

      @@reys8022 ur damn right but that profile pic is still stuck at 2018 or 19 don't you think so?

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

    Bhai!!!! Yaar really good explanation for the first time i get clear about time complexity. Such a simple and good explanation!!

  • @ravintolatajmahal
    @ravintolatajmahal 7 лет назад +2

    i wanna give u big thanks since, u present the time complexity in a easiest way ever seen. keep it up

  • @TheOverAndAround
    @TheOverAndAround 10 лет назад +1

    this is so helpful, the whole big o thing clicked to me by watching this video. Was still a little confused watching the first few videos in areas but this video made 100% sense to me.
    especially when you demonstrated just to focus on the areas that have the biggest impact to overall time and the outer and inner loop example was great for me, saying n loop x n loop = n^2 clicked inside my head.
    thanks again, best big o vid on youtube and ive watched heaps of them.
    please make some more vids on some recursive examples if you could

  • @mycodeschool
    @mycodeschool  11 лет назад

    Thanks a lot Stavros. We will try to get more in this series.

  • @thomashodges841
    @thomashodges841 7 лет назад +1

    Thank you for these videos! The book I was studying started talking about O() time, which I generally understood, but then it started in on T() time and using them in equations together also and I couldn't work out what made the two different and how they fit together. These videos gave me a clear perspective with which to finish my chapter.

  • @Utteeya
    @Utteeya 6 лет назад

    Take a bow. Amazing explanation. I find myself lucky that I have found this video in my search results.

  • @mycodeschool
    @mycodeschool  11 лет назад +4

    Sure ! stay tuned :)

  • @mycodeschool
    @mycodeschool  11 лет назад +7

    Sure Tudor, we will try to get more. :)

  • @wolverinelogan9851
    @wolverinelogan9851 10 лет назад +4

    Best explanation of time complexity analysis. Thanks a lot for the video.

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

    Great explaination after 9 years it is also clear to understood

  • @shikharsharma6399
    @shikharsharma6399 7 лет назад

    So appropriate!!!
    It is so hard to find a correct explanation. There is no certainty of material available on the internet.
    This series seems correct so far!
    VVVVVEEErrrryyyy Good!!!!

  • @vidi_shaa_
    @vidi_shaa_ 7 лет назад

    you dont know but actually you are doing a great service to the student community...lucky to come across your videos...

  • @NYCcrushinCali
    @NYCcrushinCali 6 лет назад

    This was exactly what I needed to hear. This should be taught prior to backward substitution.

  • @PRATEEKAGENT510
    @PRATEEKAGENT510 8 лет назад

    A great series of videos... short yet so descriptive. waiting for the upcoming ones!

  • @skytaer
    @skytaer 10 лет назад +257

    this is gold

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

    Finally! A video where I got the understanding of time complexity. Thankyou so much for this incredible explanation! Subscribed to your channel after watching this 1st video itself! Thankyou!!

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

    my god why did i find this guy so late. this man is amazing

  • @ZainiverseCreations
    @ZainiverseCreations 5 лет назад

    Way of teaching is excellent.

  • @science_is_awesome7070
    @science_is_awesome7070 10 лет назад +5

    Excellent lecture on time complexity, thanks for posting!

  • @xizhou6236
    @xizhou6236 5 лет назад

    You are the best ! I was confused and lost even after reading lots of explanations.

  • @thaminduKavinda
    @thaminduKavinda 5 лет назад

    Wow your explanation is very clear. our lecture spend hours to explain this

  • @randomambience6912
    @randomambience6912 8 лет назад

    Your explanation clear my all doubts, so thank you so much

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

    I know this is old but you’re the best!

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

    We need a continuation of the series, please

  • @MadhuKalluri-t2u
    @MadhuKalluri-t2u 7 лет назад +2

    best video ever on time complexity

  • @sehrgrossesglied5000
    @sehrgrossesglied5000 8 лет назад

    Prof needed 1+ hour to explain this :)
    thanks for your videos!!

  • @sushmitanigam5787
    @sushmitanigam5787 10 лет назад +1

    sir you are my god..awesome teaching..plzz do more on algorithms plzz sir so that we can get help in our gate

  • @ranjanraj6446
    @ranjanraj6446 6 лет назад

    Best explained. Understand in one shot.

  • @KanagaveluSugumar
    @KanagaveluSugumar 9 лет назад +1

    Wow what a great start on algorithams :) , you have explained very well and made a great foundations. Thank you so much!!!!

  • @stavrosmalliaris
    @stavrosmalliaris 11 лет назад

    Excellent work! Already proposed it to all my classmates in one of the best universities of Paris! Please add the O(logn) and O(2^n) cases when possible.
    Thanks a lot.

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

    It is a really good teaching video, well explained, thanks you so much!

  • @bhdr111
    @bhdr111 6 лет назад

    Thanks for the detailed and clean explanations.

  • @vivekshukla5385
    @vivekshukla5385 9 лет назад

    really sir all these classes were crystal clear 2 me, although i have joined a separate course for this i barely understood this topic, thank u very much ..but what about the further topics ..... please post them ASAP... looking forward to them

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

    Sad to hear about your friend's story Animesh, Stay Strong!

  • @joside1282
    @joside1282 11 лет назад

    Love your videos. Everything makes so much more sense now...

  • @mycodeschool
    @mycodeschool  11 лет назад +1

    Thanks for your kind words Anthony :)

  • @PratikShende91
    @PratikShende91 10 лет назад

    u taught so well. got the whole concept .....thanksss

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

    Are you a university professor? If not, you should seriously consider it. You've managed to teach how to calculate time complexity better than any of my professors.

    • @trueresources3847
      @trueresources3847 2 года назад +2

      well he's harsha s. a top coder in the country of the time. yes the country. we'll always remember him. RIP Harsha Suryanarayana. you may have gone but your work will live on. long live humblefool

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

      @@trueresources3847 Thanks for sharing. I just read the story, that's really sad.

  • @wassuphomies263
    @wassuphomies263 6 лет назад

    thank you for making this so easy to understand.

  • @sahildhawan22
    @sahildhawan22 9 лет назад +24

    Awesome! Where are the follow-up videos?

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

    You're among those few who provide playlist link in the description !

  • @mycodeschool
    @mycodeschool  11 лет назад

    Thanks Madhu.

  • @yashmaheshwari517
    @yashmaheshwari517 7 лет назад +1

    Very good, informative and excellent work. Keep going

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

    Awesome Explanations !! Really helped a lot.

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

    Thank you so much for such amazing content!

  • @jamathegentleman137
    @jamathegentleman137 6 лет назад

    thanks bro this helped me get good grade from my exam today!

  • @ishanpatel6583
    @ishanpatel6583 10 лет назад

    At 4:38, O(n+1) might come as loop would even check/compare i=n and then return false.... but it would use time in comparing! If n tends to infinity than we can neglect constant and keep it as O(n)

  • @suprakashmukherjee007
    @suprakashmukherjee007 8 лет назад +2

    hi, at the end of this video you mentioned about the next video in the series "calculating time complexity of recursive programs". I cant find it. If you have uploaded more videos in the series please provide links to the complete series.

  • @shahidshaikh4776
    @shahidshaikh4776 7 лет назад

    Thanks a lot Bro .... Really Appreciate your Efforts and very well explained.

  • @kashback7448
    @kashback7448 9 лет назад +1

    Very Clear Explanation... Thanku so Much....

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

    2020 and I watch this to increase my ability in computer science field for my job, since I am graduated from physics

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 5 лет назад

    Aweeeeeesome Explanation..I was missing that in my life..Keep going

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

    You guys aer really awesome. Please continue to make. Love 😍

  • @md.shafayatulhaque6273
    @md.shafayatulhaque6273 7 лет назад

    great tutorial. very good teacher.

  • @nahomnegash5410
    @nahomnegash5410 10 лет назад +1

    This was very helpful. Thank you!

  • @mycodeschool
    @mycodeschool  11 лет назад

    Thanks a lot Josey !

  • @amritagrawal6681
    @amritagrawal6681 8 лет назад

    simple and clear explanation, thanks for the video :)

  • @yhevrah
    @yhevrah 10 лет назад +1

    Hi, Thank you for such informative video. But can you give examples of codes that would at O(lg N), loops would be a certain indication of O(N), or O(N^2) but how about the others? For example, what is the running time of the prime function on your first video? and why? thanks.

  • @user029082
    @user029082 7 лет назад

    Thanks brother ... Lucid and best ...

  • @hemanthkumar3371
    @hemanthkumar3371 7 лет назад

    good job sir. very nice explanations.. keep doing

  • @Madhu85216
    @Madhu85216 11 лет назад

    Thanks a lot, all the 4 videos wer very helpful...

  • @sagarmehta3515
    @sagarmehta3515 7 лет назад +1

    Hello, in the tutorial we see O(n), O(n^2),O(n^3) time complexities. But when would you associate logarithmic functions to time complexities. When and how would u calculate that time complexity of a particular code is O(logn) or O(nlogn) ?

  • @BlitZnGodzilla117
    @BlitZnGodzilla117 7 лет назад +1

    Thank you this cleared up a lot!

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

    Hi Sir. First Thanks for making things crystal clear. I have a question, at last, we discussed the if and else and we took the worst case which is true for O. Instead of going to big O can we have solved that using theta that gives the tight bound ??

  • @Sparshchokra
    @Sparshchokra 8 лет назад

    Hello sir.. u did lots of efforts to make us understand the above Complexity topic, but to make a perfectionist over this topic would you please upload some more videos over this topic by which we will get over all concept of complexity like log(n),log k(n),log b(n) etc related to this ..thank you so much anyways :-)

  • @kasmanialisaad
    @kasmanialisaad 9 лет назад +2

    Thanks. Very very helpful.

  • @usama57926
    @usama57926 6 лет назад +2

    please make video on implementation of calculating time in c++

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

    So on the last part, supposing the condition was "if n

  • @hpatel6696
    @hpatel6696 7 лет назад

    Boss you are great :)
    Thank you so much for all detail explanation.....

  • @AnandKumar-yi9yk
    @AnandKumar-yi9yk 3 года назад

    2:49
    I think here time complexity is O(log n).
    Correct me if I am wrong.
    Great Work Appreciated.

  • @GradStudentTutorials
    @GradStudentTutorials 8 лет назад

    Excellent video! Thank you.

  • @windsortanner8646
    @windsortanner8646 10 лет назад

    Thanks- very clear explanation!

  • @Akvarma1992
    @Akvarma1992 9 лет назад +2

    for(i=0;i

    • @ramborambo4383
      @ramborambo4383 9 лет назад

      +Aakash Varma it would be 0(n^2)

    • @shivamkashyap8656
      @shivamkashyap8656 9 лет назад +1

      +Aakash Varma nlogn

    • @ramborambo4383
      @ramborambo4383 9 лет назад

      Shivam Kashyap How?

    • @pond.filler-4503
      @pond.filler-4503 8 лет назад +2

      +Rambo Rambo
      it is nlogn. The nested loop only increments j upto log(n) then the loop exits, so the combined run time is n*log(n) = nlogn

    • @IvanIvanov-qx5oz
      @IvanIvanov-qx5oz 6 лет назад

      the outer loop runs n times.
      each time we run the outer loop, we run the inner loop since j is always set to 0 and it increments by 1 until it reaches logn (so it runs logn times)
      so we do the whole thing is (times you run outer loop) * (times you run inner loop) = n * logn

  • @guurenez
    @guurenez 8 лет назад

    thanks for good video series on time complexity, you said next video, means it will coming into this playlist?

  • @franchescapena8287
    @franchescapena8287 7 лет назад

    thanks for making this video, very helpful!

  • @ibrahimalghamdi3888
    @ibrahimalghamdi3888 10 лет назад

    so clear explanation, my question is that what if we have the following loop
    for( i = 0;i

    • @mycodeschool
      @mycodeschool  10 лет назад +4

      You need to see, how many times the inner loop will run. it will be n-1 times for i =0 , n-2 times for i=1 and so on. So, total will be (n-1) +(n-2) + (n-3) + ... + 1= n*(n-1)/2 which will be a polynomial expression of form an^2 + bn + c for some constants a,b and c. For such time expression highest order matters. So O(n^2)

    • @ibrahimalghamdi3888
      @ibrahimalghamdi3888 10 лет назад

      mycodeschool Ok, thanks a lot. do you have video in the lower bound -big omega-?

    • @ibrahimalghamdi3888
      @ibrahimalghamdi3888 10 лет назад

      IBRAHIM ALGHAMDI Like an example, or something

  • @TheAvishkarSawant
    @TheAvishkarSawant 10 лет назад

    Awesome explanation
    ..

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

    It was very helpful thanks a lot to u....

  • @omermukhtar3394
    @omermukhtar3394 10 лет назад

    Great !...explained nicely!

  • @kishankanabar6620
    @kishankanabar6620 5 лет назад

    But As you said that big-oh represents the set,then how can they be added?there should be a union between them.And then in set terms,there is nothing like lower order terms,so they can't be ignored.

  • @Pigilili
    @Pigilili 9 лет назад

    Next video?
    log(n) complexity?
    Great job btw!

  • @vishaldeepak2538
    @vishaldeepak2538 10 лет назад +1

    gr8 tutorial guys, can you redirect me to any other of your videos where the running time of actual program is calculated, It will be great if there are examples and questions , thankx