What Is Big O Notation?

In this video, we take a look at Big O notation. We go through how Big O notation came about and why it's so useful as a method of measuring efficiency of algorithms. We then go through some examples of you can find the Big O runtime of various algorithms.
Support: / reducible
This video wouldn't be possible without the open source manim library created by 3blue1brown: github.com/3b1b/manim
Here is link to the repository that contains the code used to generate the animations in this video: github.com/nipunramk/Reducible
Music:
October by Kai Engel freemusicarchive.org/music/Ka...
November by Kai Engel
freemusicarchive.org/music/Ka...
Cobweb Morning by Kai Engel
freemusicarchive.org/music/Ka...

Пікірлер: 354

  • @DanGM123
    @DanGM1233 жыл бұрын

    i love how 3blue1brown has created a new genre

  • @vgarzareyna

    @vgarzareyna

    3 жыл бұрын

    I’ve seen a lot of videos similar to 3b1b’s lately and I love them

  • @evanward5045

    @evanward5045

    3 жыл бұрын

    You commented exactly what I and many others were going to comment

  • @S1lentG4mer

    @S1lentG4mer

    3 жыл бұрын

    I thought this was 3b1b

  • @chrisvinciguerra4128

    @chrisvinciguerra4128

    3 жыл бұрын

    Well he did make the Python library that this video used for its graphics so yeah that’s a reason why it’s similar

  • @markgross9582

    @markgross9582

    3 жыл бұрын

    Yeah. The animation styles seem similar too, so they may be using his library

  • @tiff4839
    @tiff48394 жыл бұрын

    Soo good. You broke down a commonly misunderstood topic in an intuitive and engaging way. I love it!

  • @Reducible

    @Reducible

    4 жыл бұрын

    Thanks Tiffany! I appreciate it!

  • @robertpoole9258
    @robertpoole92583 жыл бұрын

    A 3Blue1Brown for computer science. Awesome. This might end up being my favourite channel.

  • @revowolf7413
    @revowolf74133 жыл бұрын

    I cant understand how youtube isn't recommending these videos. So elegantly explained, and the animations, OMG!

  • @sifsif2725

    @sifsif2725

    3 жыл бұрын

    It just recommended this to me xD

  • @astphaire

    @astphaire

    3 жыл бұрын

    I mean his enunciation isn’t great

  • @Warpadable

    @Warpadable

    2 жыл бұрын

    Well every people watching this had this recommended... You included. Otherwise how did you find it? I agree it is awesome though.

  • @klaik30
    @klaik303 жыл бұрын

    Wow, I actually think 3B1B has created a revolution in how we should think of structuring educational videos. I'm willing to bet that in the near future his visualization program and video structure are going to be used by MANY more people and hopefully even inspire some teachers to use his methods in class. Amazing work @Reducible! You should think about doing an "Essence of Computer Science" in the future!

  • @henryroc1969
    @henryroc19693 жыл бұрын

    Easily some of the best computer science videos on youtube and definitely better than my CS professors :). Thank you for putting in all this work!

  • @saulbeck3398
    @saulbeck33983 жыл бұрын

    I came to this video with high hopes as you used Manim, yet, I was blown away with how detailed and thorough you were. I paused the video so many times, yet, not only was told what I was thinking, I was told it was normal, to think and ponder on it. I am actually blown away on how you able to teach something so simple that is a basic need for computer scientises in a way that makes me wonder how tf didn't I think of that!

  • @caloz.3656
    @caloz.36563 жыл бұрын

    this is the on video that finally settled my confusion with asymptotic notations. THANK YOU SO. MUCH. THIS IS INSANELY GOOD AND HIGH-QUALITY!!

  • @shubhamsingh-xw3tf
    @shubhamsingh-xw3tf2 жыл бұрын

    Definitely not forgetting Big O notation for a really long time! Excellent video sir! Thanks

  • @TheEndermanMob
    @TheEndermanMob3 жыл бұрын

    I've seen many channels using manim. Beside its creator, this is the most original and really good one. I'm trying to have my own channel where a explain my area with other students, and I'm having trouble programing the animations, so I need to say thanks for this beautiful work of yours.

  • @nolanfaught6974
    @nolanfaught69743 жыл бұрын

    A professor once asked the big O of an algorithm, to which I replied "O(n!^(n!))." He had to admit that I was right, then he rephrased the question as "what is the smallest big-O of the algorithm?" Never forget that a big-O is not necessarily the best bound on an algorithm, just one of many bounds

  • @12-343

    @12-343

    2 жыл бұрын

    If the answer to the question is really O(n!^n!), I think whoever wrote it is having a very rough time

  • @Magnogen

    @Magnogen

    2 жыл бұрын

    @@12-343 it's probably my code tbh

  • @wolfranck7038

    @wolfranck7038

    2 жыл бұрын

    If I'm not mistaken, the "smallest big O" is called big theta !

  • @klobiforpresident2254

    @klobiforpresident2254

    2 жыл бұрын

    @@wolfranck7038 Not quite. There are O and Omega. Big O is *an* upper bound. Often we mean the smallest (known) upper bound. Similarly Ω is *a* lower bound. Often we mean the largest (known) lower bound. When O and Ω are identical then that is called Θ.

  • @wolfranck7038

    @wolfranck7038

    2 жыл бұрын

    @@klobiforpresident2254 yeah but if you think about it, the "smallest" big O will be of the same order as the function concerned, thus also being big omega, and it will be in big theta Because smaller than that would be only big omega and bigger thant that would only be big O (It's clearly not a rigorous explanation but can't do much better in a YT comment)

  • @mehtubbhai9709
    @mehtubbhai97092 жыл бұрын

    Best explanation of Big O I have come across!

  • @dmitriyogureckiy8292
    @dmitriyogureckiy8292 Жыл бұрын

    the best video about O notation, you bring all together, even lim, cool

  • @codehorse8843
    @codehorse88433 жыл бұрын

    Thanks these are lifesavers for my current course.

  • @AshutoshKumar-de8wn
    @AshutoshKumar-de8wn2 жыл бұрын

    I love your videos for accuracy and clear content. Please upload videos on different algorithms and shortest paths.

  • @playerscience
    @playerscience3 жыл бұрын

    This is hands down the best explanation of big O notation!!! Instantly subscribed to your channel. 👌👌👌😘😘 BTW your voice is just like 3blue 1brown!

  • @hiroyukikuwana3105
    @hiroyukikuwana31053 жыл бұрын

    Hope your channel keeps growing!

  • @garr_inc
    @garr_inc3 жыл бұрын

    Never was into computer science, but it feels good to finally understand what the notation actually mean after encountering it in my higher-end math classes from time to time. Thank you!

  • @alexplastow9496
    @alexplastow9496 Жыл бұрын

    Thanks for the time you put into this video, being able to reduce complex things to something I could explain to a highschool student is thrilling in a nerdy way

  • @Bloody_Mary_
    @Bloody_Mary_3 жыл бұрын

    Beautiful presentation accompanied with fantastic music of enlightenment!

  • @rjmbowie
    @rjmbowie3 жыл бұрын

    Amazing video! Love the use of manim.

  • @dehilihind2916
    @dehilihind29162 жыл бұрын

    thanks for your efforts , I just discovered your channel and it's INCREDIBLY helpful !

  • @lucha6262
    @lucha62623 жыл бұрын

    What a great video! Thanks so much!

  • @ishikuultra3637
    @ishikuultra36373 жыл бұрын

    This is the best explanation I've ever seen.

  • @suzalwakhley5329
    @suzalwakhley5329 Жыл бұрын

    A very simple and detailed explanation. Thank you very much

  • @strandedinanisland457
    @strandedinanisland4573 жыл бұрын

    This is so easy to understand....roughly 2 years ago I tried to gather this information on Computational complexity from a big book and ended up understanding very little.

  • @hotpushupguy4203
    @hotpushupguy42033 жыл бұрын

    These are so wonderful - thank you !

  • @phonylattice2743
    @phonylattice27433 жыл бұрын

    Thank you for this amazing video!

  • @Xxnightwalk1
    @Xxnightwalk12 жыл бұрын

    Really instructive, as always Keep up the amazing work ;)

  • @BeeshoStudying
    @BeeshoStudying2 жыл бұрын

    you have the best explanation. thanks for the video

  • @chrislam1341
    @chrislam13413 жыл бұрын

    by far it is the best explanation after years of search.

  • @eamonnsiocain6454
    @eamonnsiocain6454 Жыл бұрын

    Well presented! Thank you.

  • @erv993
    @erv9933 жыл бұрын

    Thanks so much! You have invaluable content!

  • @kaleabfetene6258
    @kaleabfetene62582 жыл бұрын

    Such a great video thank you so much I honestly don’t have enough words to thank you appreciate that

  • @olanrewajubabalola2322
    @olanrewajubabalola23222 жыл бұрын

    BEST VIDIEO ON BIG O NOTATION!!! every other video out there just leaves me more confused. thank you.

  • @weirongwu4964
    @weirongwu49643 жыл бұрын

    This masterpiece omg thank you so much!

  • @isaacfernandez2243
    @isaacfernandez2243 Жыл бұрын

    Wow, this was incredibly good. Thank you.

  • @HienNguyenHMN
    @HienNguyenHMN3 жыл бұрын

    @ 14:55 "we can actually use this 'symme-tree' to help us"

  • @joaquingutierrez3072
    @joaquingutierrez30723 жыл бұрын

    I loved this video. Thank you !

  • @Pewpewpew230
    @Pewpewpew2302 жыл бұрын

    Great work, thanks!

  • @blueskyjavelin2289
    @blueskyjavelin22893 жыл бұрын

    This video helped me alot. Thank you:)

  • @hisyamzayd
    @hisyamzayd2 жыл бұрын

    Love how to find big o with graph explanations.. thank you 😀😀

  • @_maus
    @_maus2 жыл бұрын

    Thank you so much and I really appreciate the video.

  • @FRANKFIFORM
    @FRANKFIFORM2 жыл бұрын

    Great video!! I’ve always have doubts about this topic.

  • @anwarulbashirshuaib5673
    @anwarulbashirshuaib56733 жыл бұрын

    How come I noticed this masterpiece so late!? Definitely subscribing!

  • @georgeharrisonOK
    @georgeharrisonOK3 жыл бұрын

    Good video, keep up the good work!!

  • @jayantverma6196
    @jayantverma61964 жыл бұрын

    You are amazing, please upload more videos.

  • @snoopy1alpha
    @snoopy1alpha2 жыл бұрын

    Very well explained! I guess I will quote this video in my next complexity discussion at work :-D

  • @ClearerThanMud
    @ClearerThanMud2 жыл бұрын

    Clearest, most complete Big-O video I've seen. Kudos. It looks like you used Grant's manim package to create this. I have been thinking of learning manim so I can create a video giving some insight into why the radix sort is so fast. Work doesn't leave me much time for such pleasures, though; you do such a good job with this, if you are interested I can privately explain the insight so you could make the video if it appeals to you.

  • @jaumm84
    @jaumm843 жыл бұрын

    Thanks! I finally undestood it!

  • @isabellelindblad2835
    @isabellelindblad28353 жыл бұрын

    This was amaaaazing

  • @1DInciner
    @1DInciner2 жыл бұрын

    Was expecting several animations about other big O examples, like exponential one. It is very interesting to see them in comparison.

  • @diegovasquezrevilla
    @diegovasquezrevilla3 жыл бұрын

    Great video keep up the good work

  • @sbsyr5555
    @sbsyr55552 жыл бұрын

    Nicely explained...

  • @sharanphadke4954
    @sharanphadke49543 жыл бұрын

    just put some thinking pi's and this literally becomes 3blue 1brown video!!! Really great channel

  • @playerscience

    @playerscience

    3 жыл бұрын

    Exactly! He is the 3blue 1brown of Computer science. 😎🔥🔥🔥

  • @NovaWarrior77
    @NovaWarrior773 жыл бұрын

    ABSOLUTELY AWESOME I-

  • @skyslasher6267
    @skyslasher62672 жыл бұрын

    as a junior in cs right now, in my opinion, this is a must watch for all people trying to get a degree in programming

  • @hamzaich7034
    @hamzaich70343 жыл бұрын

    Maaaaan this is amazing ♥️♥️♥️

  • @joaofrancisco8864
    @joaofrancisco88643 жыл бұрын

    So good!

  • @shimavalipour5992
    @shimavalipour59922 жыл бұрын

    u explained it sooooo goooood, thanks

  • @abdelbassetlabbi852
    @abdelbassetlabbi8523 жыл бұрын

    incridible! just continue bro

  • @marpin6162
    @marpin61623 жыл бұрын

    who came from 3blue1brown’s post?

  • @brooksbryant2478

    @brooksbryant2478

    3 жыл бұрын

    Me

  • @LeoStaley

    @LeoStaley

    3 жыл бұрын

    Which one?

  • @bazsnell3178

    @bazsnell3178

    3 жыл бұрын

    Me

  • @ronaldboulder308
    @ronaldboulder3083 жыл бұрын

    I remember this topic being explained in algorithm courses very similarly.

  • @kudzem
    @kudzem2 жыл бұрын

    O(2^N) : "Yo, I'm so complex" O(N!) : "What was that, punk?"

  • @givrally7634
    @givrally76342 жыл бұрын

    Now I want big O of big O notation, to group like growth rates together : polynomials, exponentials, and so on.

  • @dwolrdcojp
    @dwolrdcojp2 жыл бұрын

    I love this channel

  • @joelflanagan7132
    @joelflanagan71322 жыл бұрын

    Cool video.

  • @discreet_boson
    @discreet_boson3 жыл бұрын

    It would be an understatement to say this channel is underrated

  • @mobydick0316
    @mobydick03162 жыл бұрын

    大學的演算法 當初根本聽不懂 這個影片超有幫助 感謝講解

  • @nadonadia2521
    @nadonadia25212 жыл бұрын

    Great video i love the topics and the way that have been presented may teacher have not your skills, please more videos on running algorithmes programming ideas, thank you, i have subscribed to tthe channel.

  • @samuelatienzo4627
    @samuelatienzo46272 жыл бұрын

    Jeez I learned more here in 15 mins than a few weeks of my statistics and numerical methods class...

  • @thoraxlaneus9961
    @thoraxlaneus99613 жыл бұрын

    This is so great

  • @tucan1309
    @tucan13093 жыл бұрын

    i didnt come from 3b1b but im suprised at quality of these videos

  • @absolutezero6190
    @absolutezero61903 жыл бұрын

    I noticed a small error in your video. You typed two quotation marks in LaTeX at 9:59 . They are both ending quotation marks. The way to fix this is to use this markup: ``this will be surrounded with proper quotation marks when rendered in \LaTeX’’ Notice that I used two single quotes at the end (‘’) not a double quote (“).

  • @johnmeyers8542

    @johnmeyers8542

    2 жыл бұрын

    Good catch. Although you missed 'defintiion' spelled with the lesser used two 'i's. Neither latex or other rubberised products will help with that one.

  • @anasasim3856
    @anasasim38563 жыл бұрын

    I want to give you a hug bro!

  • @darkelwin02
    @darkelwin023 жыл бұрын

    Hey good video explaining it. I think including the Factorial class would have been useful. While yes you dont see those outside graphs often, making an algoritmh on your own and recognizing to stay away from that class is practical

  • @the_cheese_cultist
    @the_cheese_cultist2 жыл бұрын

    you probably should've added O(sqrt n) and O(n!) to your "common running times" list since they do appear quite often as well

  • @co9681
    @co96813 жыл бұрын

    Man manim is awesome

  • @ccdavis94303
    @ccdavis943033 жыл бұрын

    O(?) is deep and important in understanding processes in general, not just computing. Social structures scale in scary ways. Some stuff works great at dining room table scale (N~6), is still functional at the scale of a monastery (N ~ 100) but when they scale to small countries ( N ~ 20MM) let alone large countries ( N ~ 300 MM ) or huge countries ( N ~ 1 Billion) it hits the fan. Central planning for example. The Soviets set up an office to make sure everything was fairly priced relative to other stuff. Easy right? But there were N ~ 25 MM items in the economy. So relative fairness is N^2, but everything is fair compared to itself, so N^2 - N. Further comparison is sort of symmetric, so (N^2 -N)/2. Big improvement but when N = 25 MM, O(fair) ~ 312 trillion. Poor aparatchicks. (Tom Sowell cited this case) { if a is fair relative to b and b is fair relative to c, is a fair relative to c? How much would this improve things?}

  • @jursamaj

    @jursamaj

    Жыл бұрын

    That argument is obviously fallacious. You don't need to compare the price of every type of watch to every type of car, and every type of bread, etc. The watches only need compared amongst themselves, and to some baseline.

  • @Adrian-nq2bp
    @Adrian-nq2bp2 жыл бұрын

    Awesome.

  • @Adomas_B
    @Adomas_B3 жыл бұрын

    I keep reading the text in 3blue1brown's voice

  • @joeyhardin5903

    @joeyhardin5903

    3 жыл бұрын

    ikr!!

  • @manamsetty2664
    @manamsetty26642 жыл бұрын

    The Man.The Myth.The Teacher

  • @herlusz
    @herlusz3 жыл бұрын

    The second definition is quite understandable

  • @nomi98
    @nomi982 жыл бұрын

    Glad my teachers taught me well lol.

  • @kopiking352
    @kopiking3522 жыл бұрын

    The best !!!

  • @matthewcrunk4165
    @matthewcrunk41652 жыл бұрын

    Oh I thought this was 3blue1brown but with an odd accent. Great video, might I recommend making your visual style a tiny bit more distinct. Since honestly its great to have a thing that makes your channel stand out a bit. Like I think you even picked the same font, unless Im mistaken

  • @mychannel-te5ke
    @mychannel-te5ke3 жыл бұрын

    11:45 It's not really true that there should be such a limit. It may not exist. For example g(n) / f(n) may by 1 for even n's and 2 for odd n's. So there's no limit in this case. Even more. It's true that for f(n) = n and g(n) = n^2 it's true that n = O(n^2). But g(n) / f(n) = n has no limit.

  • @diegocfq

    @diegocfq

    3 жыл бұрын

    Yeah, it's supposed to be lim sup instead of just lim and an absolute value operator should be applied on the numerator of that fraction.

  • @DavidPysnik

    @DavidPysnik

    3 жыл бұрын

    How would lim sup help Сергей Обритаев's example? if f(n) = n and g(n) = n^2, the limit as n goes to infinity of g(n)/f(n) would not exist because it goes to infinity, so the lim sup of this expression going to infinity would also not exist. Even with lim sup in that definition shown at 11:45, it doesn't allow n = O(n^2) as the original definition does, so Сергей Обритаев's criticism does not seem fixed.

  • @johnmcleodvii

    @johnmcleodvii

    2 жыл бұрын

    O notation does not require that the function has a strict limit in the terms that calculus does. If odd numbers for input are one growth in n and even numbers are something other growth in n, the O notation would be for the faster growing one. So in the example where odd numbers had linear growth and even numbers had n² growth, the O notation would be O(n²). Off the top of my head, I can think of no algorithms that have significantly different behaviors for even and odd n.

  • @cross_roadz
    @cross_roadz3 жыл бұрын

    If only I saw this before my discrete mathematics exam

  • @Starwort
    @Starwort2 жыл бұрын

    That last example emphasises the importance of caching - caching would reduce the runtime to O(n) worst-case and O(1) best-case (of course, it could also be reduced to O(n) simply by multiplying the recursive result by 2)

  • @hayaokakizaki4463
    @hayaokakizaki44632 жыл бұрын

    It's showtime!

  • @ruin9
    @ruin93 жыл бұрын

    Ur awsumm 🙏

  • @moonst6020
    @moonst60203 жыл бұрын

    I am here to cry over my upcoming tests🙂

  • @aks9545
    @aks95453 жыл бұрын

    Thanks

  • @knalkayal5014
    @knalkayal50144 жыл бұрын

    That is a nice video one. Please bring a video on "Space Complexity of an algorithm". Thank you.

  • @user-zm3hv5df1y
    @user-zm3hv5df1y3 жыл бұрын

    At 15:53 table 1->1, 2->2, 3->4, 4->8, 5->16; at 16:15 If n=k, Count = 2^(k-1)= 2^k/2

  • @mikesolo7993
    @mikesolo79932 жыл бұрын

    I bring up BigO at work and people's eyes glaze over. I've stopped trying to explain, but damn with this video I think anyone could understand it!

  • @GuadalupeAnimation
    @GuadalupeAnimation2 жыл бұрын

    Do someone know how this guy makes its animations? I would like to learn to make my classes more visual

  • @tamptus3479
    @tamptus34793 жыл бұрын

    What is difficult with this Definition? We do not define O(f) but we define =O(f) the Equal Sign has now no longer the meaning "equal". Example if f = O(g) and h = O(g) then f and h may not equal. if the = has the meaning "equal" O(f) have to be a function, but this is not the case.

  • @perrydimes6915

    @perrydimes6915

    2 жыл бұрын

    You're right, it is better to think about it as set inclusion. If you know anything about set theory, this is the "is in" or "is an element of" or simply ∈. So we would say f ∈ O(g), and h ∈ O(g). I believe this is the single biggest issue with understanding, because we're using an equals sign for something that is NOT equality. O(g) is a set. f, g, and h are all functions.

  • @legendgames128
    @legendgames1282 жыл бұрын

    12:20 I argue that you can cram extra items between constant and logarithmic, by considering the inverse of the Ackermann function. n=3 would equal the cube root of 3. n=2 would be 1 (2/2) and n=1 would be 0 (1-1)

  • @brianherring3776
    @brianherring37763 жыл бұрын

    Well done! What tool(s) are you using to create this content?

  • @askii2004

    @askii2004

    3 жыл бұрын

    It's liked in the description! It utilizes manim, which was developed by Grant Sanderson (3Blue1Brown).