What Is Big O? (Comparing Algorithms)

  Рет қаралды 169,304

Undefined Behavior

Undefined Behavior

7 жыл бұрын

With so many ways to solve a problem, how do we know which was is the right one? Let's look at one of the most common methods for analyzing algorithms: Big O Notation.
Created by: Cory Chang
Produced by: Vivian Liu
Script Editor: Justin Chen, Brandon Chen, Elaine Chang, Zachary Greenberg
Twitter: / ubehavior
-
Extra Resources:
Big O Wiki: en.wikipedia.org/wiki/Big_O_n...
Analysis of Algorithms: en.wikipedia.org/wiki/Analysi...
Time Complexity: en.wikipedia.org/wiki/Time_co...
Sorting: en.wikipedia.org/wiki/Sorting...
Fast Inverse Square Root: en.wikipedia.org/wiki/Fast_in...
Picture Credits:
s-media-cache-ak0.pinimg.com/...

Пікірлер: 107
@ricardoamaya2500
@ricardoamaya2500 6 жыл бұрын
Searched for Big O, came for the pokemon
@artbridder
@artbridder 6 жыл бұрын
stayed for the pokemon?
@DrRiq
@DrRiq 4 жыл бұрын
it's "came for big O, stayed for the Pokemon"
@kingshukcs
@kingshukcs 6 ай бұрын
Listen man....this video was awesome!! and it totally deserves more than 150k views. Your examples were just amazing....they flipped switches in my brain so thank you!!
@keymaster9306
@keymaster9306 6 жыл бұрын
Actually I had a hard time wrapping my head around these concepts. But the metaphors used in the videos were so good, in fact it was very fascinating. Thanks for explaining this in a very interesting manner.
@Sparkesix
@Sparkesix 7 жыл бұрын
Another great video! I knew about the notation before, but you really nicely explained it to those that might be new to it. Keep it going! Unlike the other commenters, I think the analogies were on point, especially the train one.
@andrewdelgado9815
@andrewdelgado9815 6 жыл бұрын
Most straight forward video I have seen on Big O. Great job!
@alonsorobots
@alonsorobots 5 жыл бұрын
Love these videos! Would love to see more CS and Algorithms explains this way =)
@pc8505
@pc8505 5 жыл бұрын
This is so amazing and easy to understand! Thanks a lot!
@alexanderf8451
@alexanderf8451 6 жыл бұрын
Props for including fast inverse square root!
@kyle.nguyen
@kyle.nguyen 6 жыл бұрын
This is a really great visualization of the Big O concept
@jobsjaz369r7
@jobsjaz369r7 5 жыл бұрын
That was brilliant. I don't come from a computer science background and this was the only video so far that clarified what big o is. Thank you. Have subscribed 😊
@williamw8590
@williamw8590 6 жыл бұрын
This is super helpful! I love the simplicity of this explanation. Subscribed!
@neo_snakejazz
@neo_snakejazz 3 жыл бұрын
Excellent video, thanks for making it available to us.
@kerryjackson6773
@kerryjackson6773 4 жыл бұрын
Awesome video, loved the metaphors!
@CarlosAlbertBR
@CarlosAlbertBR 4 жыл бұрын
what a wonderful and clear explanation. thank you
@sajaal-dabet148
@sajaal-dabet148 Жыл бұрын
This is so brilliant! Keep doing such videos plz
@poggly
@poggly 5 жыл бұрын
If you already kind-of-not-quite-100% get Big O, the metaphors here are actually pretty good. If you're still confused about Big O I recommend looking at the limit definition/interpretation if you know what it means in calc. It's basically like when you learn limits- what happens when x gets really really big in f(x) compared to g(x).
@PrabhathDarshana
@PrabhathDarshana 6 жыл бұрын
WOW, That's pretty clear!! Thanks.
@aidayana3253
@aidayana3253 3 жыл бұрын
I really love the content and the way you share it
@jamesmiller2521
@jamesmiller2521 4 жыл бұрын
Algorithms! Gotta understand 'em all!
@classcube
@classcube 7 жыл бұрын
Thanks for this. I like that you're explaining it without even touching code. Mario and Harry Potter make for a better explanation than code.
@Jemmeh
@Jemmeh 6 жыл бұрын
This is fantastic. Love the metaphors, it helps it be more tangible. Thanks for the video!
@itsiwhatitsi
@itsiwhatitsi 6 жыл бұрын
This seems like a David Lynch film: hard to understand but many people like it anyway
@khushiaswani6500
@khushiaswani6500 4 жыл бұрын
it looks so professional but personally I didnt get a thing lol
@flatbox1416
@flatbox1416 3 жыл бұрын
0:38, I nearly had a stroke.
@martintirpak1033
@martintirpak1033 6 жыл бұрын
I found this explanation great, would help me alot if I saw it when I first learned about O notation :)
@almostbutnotentirelyunreas166
@almostbutnotentirelyunreas166 7 жыл бұрын
As the self-proclaimed owner-driver of a multi-level, self-adjusting feed-back loop (neural network?), I want to thank you for for the equivalent of a Vit B12 shot . Interesting how so many ''obvious' solutions only become 'obvious' AFTER they have been recognised /explained by a master. Well done, and Thank you.
@rayerdyne
@rayerdyne 4 жыл бұрын
Animations are just wonderfull. I-I c-can't hold back from hitting like button !
@karthiksantosh3475
@karthiksantosh3475 4 жыл бұрын
this is the best vedio i seen more than 10 vedios on big oh but this vedio made me understand sooo fast thanks a lot bro
@Revycake
@Revycake 3 жыл бұрын
I watched a bunch of big O videos because I just didn't get it from my lessons at uni. This is super understandable and actually fun. Thank you!!
@FindusGame11
@FindusGame11 6 жыл бұрын
The n log n limit on sorting only applies for sorting algorithms that compare elements. For example, you can sort in linear time using radix or counting sort
@kneeboardcrasher
@kneeboardcrasher 6 жыл бұрын
This was a an awesome video!
@second_second_
@second_second_ 3 жыл бұрын
Wow, the cutest video about Big-0 i've ever watched (pokemon). wished i understand other references as well
@rebecaperez4472
@rebecaperez4472 3 жыл бұрын
this is the best explanation of big O I have seen.
@shepbryan4315
@shepbryan4315 Жыл бұрын
Great video! Also, I think it's absolutely hilarious that the analogy to ignoring scaling factors is that "we allow the algorithms to take performance enhancing drugs" lol
@LetsBeHuman
@LetsBeHuman 5 жыл бұрын
very well explained with examples and graphics. Subscribed. this is the perfect example of explaining to a 5 year old kid.
@kallihale5197
@kallihale5197 8 ай бұрын
This deserves more views.
@karimk8551
@karimk8551 6 жыл бұрын
excellent explanation
@maraud3r_
@maraud3r_ 7 жыл бұрын
Very well explained
@tsunghan_yu
@tsunghan_yu 5 жыл бұрын
excellent video!
@gisforgirard
@gisforgirard 6 жыл бұрын
this is literally the best video I have ever seen on the entire internet. thank you for this.
@carloslaguna7036
@carloslaguna7036 3 жыл бұрын
How do you create your animations?
@bren007pie2
@bren007pie2 2 жыл бұрын
Incredible quality
@Malik-qh7wq
@Malik-qh7wq 5 жыл бұрын
Great! Thnx
@simonthelen5910
@simonthelen5910 4 жыл бұрын
I'm not sure if the racer analogy is that helpful for understanding Big O if you've never heard of if, but I personally found it pretty fascinating. I've never thought about idea of linear time meaning constant speed and logarithmic time meaning constant acceleration.
@zyrocks2
@zyrocks2 6 жыл бұрын
still no freaking clue what "O" is.. is it just there as a decoration? no clue...
@gemyellow
@gemyellow 6 жыл бұрын
Big O notation, also called Landau's symbol. Landau's symbol comes from the name of the German number theoretician Edmund Landau who invented the notation. *The letter O is used because the rate of growth of a function is also called its 'order'.*
@gingeral253
@gingeral253 Жыл бұрын
Cool stuff
@affshafee.rahman
@affshafee.rahman 4 жыл бұрын
If at 6:44, the worst, average and best cases are all big-Ohs, then where does big-Theta and big-Omega fit?
@user-yd9xy3rb4x
@user-yd9xy3rb4x 2 жыл бұрын
you rock man
@gkmishra2009
@gkmishra2009 7 жыл бұрын
Give lecture on - Brute Force, Greedy method, branch and bound, backtracking , dynamic programming , asymptotic analysis (best,worst,average cases), of time and space , upper and lower bound, basic concept of complexity classes- P, NP,Np-hard,NP-complete, graph and tree algorithm , depth breadth first traversal , tractable and interactable problem
@LuvElaYay
@LuvElaYay 5 жыл бұрын
great video
@MrKibujo
@MrKibujo 6 жыл бұрын
undefined behavior gives me unexpected great video.
@mattwaters9008
@mattwaters9008 3 жыл бұрын
comp sci and pokemon. finally the youtube algo doing something right
@charlliemurphy8381
@charlliemurphy8381 4 жыл бұрын
brilliant
@maulob1523
@maulob1523 5 жыл бұрын
Or, to state that beginning "mess" of a definition in a graphical way: 1) Draw f(x) in a coordinate System. 2) Draw g(x) in the same system, but you can squish it as much as you want. 3) Look as far right as you want, starting from any arbitrary point that you want 4) f(x) is in O(g(x)) when f(x) never overtakes g(x) from said point onward
@madghostek3026
@madghostek3026 4 жыл бұрын
Thing that helped me understand this after many hours: the definition of big o ISN'T connected to effeciency of alghoritms itself, it explains how it works - you have 2 functions, one f one g, and on graph you clearly see that one (let's say f) at some point ends up under g. Now, no matter what you do to g without changing it's shape, so only moving and rotating around, if you go far enough it will overcome f at some point. And I was stuck here... what does it have to do with alghoritms??? The answer is that t(n), the time function of your alghoritm, likely a code, is interested in the worst case - the fact of going far enough to the right. To find out what would happen in such case, you can use O() that will give you the upper bound of possible time needed, since it makes the function go far to the right. One more thing: it is obvious that your alghoritm won't always perform in the worst time, the O notation is used for things like hardware requirments, where you need to be prepared for worst. There's also less used average time based calculation. To sum up, the O function kind of rates the shape of time function describing your alghoritm, or how it handles huge/tricky inputs
@srincrivel1
@srincrivel1 6 жыл бұрын
yo, this was really cool
@dimitrijep7872
@dimitrijep7872 5 жыл бұрын
very good explanation...if you don't get it here's an example: g(x) = O(f(x)) means that f(x) has a longer execution time, the time it takes to finish. In other words, any function that runs faster than f(x) will be O(f(x))
@matthewjackson9260
@matthewjackson9260 5 жыл бұрын
I only liked your comment because you can send it bro.
@jaganmathadevidasi5786
@jaganmathadevidasi5786 4 жыл бұрын
Thank u ☺️
@ikki2526
@ikki2526 6 жыл бұрын
thank you very very much from thai.
@javierbg1995
@javierbg1995 7 жыл бұрын
Nice video! Just as a small note: the code at 7:55 doesn't actually compute (approximate, really) the square root of a number, but the INVERSE of the square root. It's equivalent readable code would be: 1 / Math.sqrt(n). For anyone interested in the algorithm and the code check the Wikipedia page: en.wikipedia.org/wiki/Fast_inverse_square_root Here are some slides that explain quite well how it works and how anyone could come up with it: www.bullshitmath.lol/FastRoot.slides.html#/
@nguyenquangminh4814
@nguyenquangminh4814 4 жыл бұрын
omg thank you
@sudoku37
@sudoku37 5 жыл бұрын
I just pause in the middle of the video and check the comment, move to another video.
@khushiaswani6500
@khushiaswani6500 4 жыл бұрын
same bruh
@vojtechfric9470
@vojtechfric9470 7 жыл бұрын
Maybe it is because I already know the subject, but the metaphores at the start seemed quite confusing. Also the graph (turtle, car, train, Mario, ...) is a bit confusing. You have X axis called distance, and Y axis called time. But the function are in terms of N. That might be confusing to some.
@pingshiyu
@pingshiyu 7 жыл бұрын
Vojtěch Frič I agree, I feel like there must exist better ways to introduce this subject. I don't think this would have been all too clear for me if I was learning from this initially.
@rafaelmarques1773
@rafaelmarques1773 7 жыл бұрын
I didn't know any of this. This was as clear as I can think of (surely I don't understand it in any depth level but most ideas of CS to someone outside is to be kept at a ground level at first), I think you guys are suffering from overthinking, because you already know it. However, there are always quite some room to improvement, like the inverted axis. You can give it a push by just puting a note to remind of it, I only noticed it when you said that n² would take longer than n.
@jamebonez
@jamebonez 6 жыл бұрын
I was having a hard time understanding the topic until I watched this video. The examples were very helpful.
@marklu5521
@marklu5521 3 жыл бұрын
goddamn it, could you have a legend that shows what each math notation means? thanks lol
@grainfrizz
@grainfrizz 6 жыл бұрын
f of x is in big O of g of x if and only if there exists a k and an x-naught, such that for all x greater than or equal to x-naught, f of x is less than to k times g of x
@omerkaraca2939
@omerkaraca2939 6 жыл бұрын
you are the deep of man!!! thank you dude!
@aresxena6632
@aresxena6632 5 жыл бұрын
0:27 Biggest ''fuck you'' I've had all day.
@imadhamaidi
@imadhamaidi 4 жыл бұрын
can anyone bother to explain what the code in 07:57 is?
@oolivergraham
@oolivergraham 3 жыл бұрын
kzbin.info/www/bejne/pmnYkJ5oga6Nr9E
@abeer141
@abeer141 3 жыл бұрын
It wasn't easy... I went throw 6 other videos so now your video made a sense to me.... But for anyone new it isn't easy... I recommend to watch this video at last after you have watched few others... It will make the concept smooth
@muhammadneanaa1611
@muhammadneanaa1611 4 жыл бұрын
genius!
@robotspgc
@robotspgc 5 жыл бұрын
How do you not have more subscribers?
@janmichaelbesinga3867
@janmichaelbesinga3867 5 жыл бұрын
I almost died when he say easy
@puglife1343
@puglife1343 Жыл бұрын
not gonna lie, came for the thumbnail
@TimeLordVictorious11
@TimeLordVictorious11 6 жыл бұрын
at 0:18 how many of you thought of church from RvB instead of halo? lol kzbin.info/www/bejne/iJ7GZ2lnlp58iLs
@Idan-tc5rt
@Idan-tc5rt 6 жыл бұрын
1:16 this is kind of confusing. Your explanation of being 'fast' might make people think that it means that the algorithm is of a higher degree or complexity (like n is higher than log(n)), when in reality it's easier to imagine that Usian Bolt is O(1).
@opus_X
@opus_X Жыл бұрын
Bogosort #1!
@manifest_it_man
@manifest_it_man 5 жыл бұрын
subscribed for guilty spark
@adamblackler488
@adamblackler488 5 жыл бұрын
n! You heard it here first!
@knightonhd1144
@knightonhd1144 3 жыл бұрын
It was starting to click with the umbrella but then I got lost again. I apologize master, I am a slow learner #anakinskywalker
@InstaCody
@InstaCody 2 жыл бұрын
I wasn't getting it until I saw Mario. I love Mario
@dotwarner17
@dotwarner17 4 жыл бұрын
I'm one of the tomatoes!
@licolhavaiia2205
@licolhavaiia2205 4 жыл бұрын
0:38 "easy, right ?" sike
@DrRiq
@DrRiq 4 жыл бұрын
that's the joke..
@meghanabhange13
@meghanabhange13 7 жыл бұрын
Any other Whovians Jumped when they saw the TARDIS?
@Onnethox
@Onnethox 3 жыл бұрын
At this point I only work for exams without understanding jack sh1t
@Annettewalker-nq2jf
@Annettewalker-nq2jf 5 жыл бұрын
i came here for pokemeon
@killerwhiteshark1797
@killerwhiteshark1797 4 жыл бұрын
I clicked on this because the Pokemon
@EUROSPORTS4TECH
@EUROSPORTS4TECH Жыл бұрын
Gg
@salek991
@salek991 6 жыл бұрын
Obviously Scyther with Double Team is faster than mr. Bolt.
@dailytimelapse8414
@dailytimelapse8414 6 жыл бұрын
this video is confusing... lolol
@MukeshRajput1982
@MukeshRajput1982 6 жыл бұрын
Very Informative........... kzbin.info/door/oscfxTBY93lYauulG-fBRw www.mukeshrajput102.com/
@BruceRicard
@BruceRicard Ай бұрын
This is the only video on Big-O I could find that uses the word "asymptotic" to define it. And yet it seems like you don't understand what it means. Because the conclusion should be that Big-O is completely useless, as all it tells us is what happens in a neighborhood of infinity, and nobody cares about that in practice.
@gazorb2
@gazorb2 4 жыл бұрын
I don't understand this one at all.
@webgpu
@webgpu 6 жыл бұрын
pokemon analogy? what's your audience? kindergarten?
@LetsBeHuman
@LetsBeHuman 5 жыл бұрын
why not kindergarden kids start learning these.
@DanT-iu6oc
@DanT-iu6oc 4 жыл бұрын
not a very intuitive, introductory explanation. please go about it slower and more basic!!!!!!
P vs. NP - An Introduction
10:10
Undefined Behavior
Рет қаралды 219 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 424 М.
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 30 МЛН
Survival skills: A great idea with duct tape #survival #lifehacks #camping
00:27
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 124 МЛН
What Is Big O Notation?
17:45
Reducible
Рет қаралды 311 М.
P = NP Explained Visually  (Big O Notation & Complexity Theory)
11:16
Art of the Problem
Рет қаралды 158 М.
The Bubble Sort Curve
19:18
Lines That Connect
Рет қаралды 464 М.
How to calculate the complexity of an algorithm by BIG O | The clearest explanation!
25:44
Front-end Science із Сергієм Пузанковим
Рет қаралды 121 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
ЗЕ МАККЕРС
Рет қаралды 180 М.
WATERPROOF RATED IP-69🌧️#oppo #oppof27pro#oppoindia
0:10
Fivestar Mobile
Рет қаралды 17 МЛН
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 7 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 1,4 МЛН
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 145 М.