Big O Notation

Sdílet
Vložit
  • čas přidán 26. 09. 2016
  • Learn about Big O notation, an equation that describes how the run time scales with respect to some input variables. This video is a part of HackerRank's Cracking The Coding Interview Tutorial with Gayle Laakmann McDowell. www.hackerrank.com/domains/tut...
  • Věda a technologie

Komentáře • 567

  • @christinehill4584
    @christinehill4584 Před 6 lety +1975

    Here's my favorite Big O analogy:
    Let's say you're making dinner for your family. O is the process of following a recipe, and n is the number of times you follow a recipe.
    O - you make one dish that everyone eats whether they like it or not. You follow one recipe from top to bottom, then serve (1 recipe).

    • @shubhamnegi1937
      @shubhamnegi1937 Před 6 lety +14

      Chris Hill, good analogy. For O(log n) one dish is being served to all the groups or a dish for each group?

    • @B-Billy
      @B-Billy Před 6 lety +2

      One dish per group.

    • @me-zz2340
      @me-zz2340 Před 6 lety +107

      O(n^2) analogy is not very good. I think if every person in your family makes individual dish for every person (so every person will have n dishes) - this could be O(n^2)

    • @spray-r9951
      @spray-r9951 Před 6 lety +7

      This analogy is fire!!!

    • @flybeep1661
      @flybeep1661 Před 6 lety +83

      Simon WoodburyForget I guess you don't know what an "analogy" is. You just explained it in your way without making an analogy at all. Using analogies is a way to describe complex concepts in an as simple as possible way. The simpler the explanation the better the analogy. You just explained it in a fashion you would understand it best which isn't necessary the best way for others. Making anlalogies circumvents this problem. I hope you're not a teacher, you wouldn't be good at it.

  • @codinginflow
    @codinginflow Před 6 lety +2517

    So Big O is not a rapper?

  • @lassulfi
    @lassulfi Před 4 lety +285

    PTP - Pigeon Transfer Protocol

  • @jameswon5497
    @jameswon5497 Před 5 lety +13

    Thanks so much, this 8 minute video made it way more clear than several hours of lectures and readings

  • @joe44850
    @joe44850 Před 6 lety +712

    I might be too stupid to be a software developer. Unfortunately, I have learned this after 20 years of being a software developer. There are some things you need to know to impress people interviewing you that you may never touch on the job.

    • @fierce10
      @fierce10 Před 6 lety +168

      An older interviewer who was a director at a company failed me because he asked a question on this and he didn't know to drop coefficients. He insisted in the interview that its O(2N) and I got it wrong by saying its O(N).

    • @spray-r9951
      @spray-r9951 Před 6 lety +11

      You probably are

    • @rxtx3948
      @rxtx3948 Před 6 lety +34

      sometimes it feels frustrating that the interviewer knowledge is limited and he is just denying the same fact.

    • @danbo967
      @danbo967 Před 5 lety +11

      My take on all this is this, if you work for a company that processes few records (entities, etc.) you usually are fine without complex algorithms unless you have to do complex operations. If the company processes a lot of records it becomes increasingly helpful (O(N)... did you get it ) to use algorithms and Big-O notation. Especially for companies that are algorithm intensive like Amazon, Facebook, Google, etc.

    • @funinchico84
      @funinchico84 Před 5 lety +42

      No. It allows you to *prove* that an alternative is more/less efficient. If a developer can only come up with O(n^2) solution, then big O can tell you it's slow. Which is exactly what my computer can tell me with benchmarks. There's a benefit to knowing the notation, but it doesn't automatically make your code more efficient.

  • @connergesbocker9902
    @connergesbocker9902 Před 7 lety +1

    Gayle!!! I just started reading cracking the coding interview and what a pleasant surprise to stumble upon this channel. Great educator and author. Thanks for the video :-)

  • @yongaisim6845
    @yongaisim6845 Před 6 lety +15

    What a simple but clear explanation on Big O. I finally found you. Many videos start off with even more complex mathematical terms that are difficult to understand by themselves. You start very simply. Magnificent! How about one on Tractability to help.

  • @10uRization
    @10uRization Před 4 lety +2

    Although you left some other necessary o notations, your lectures are great! I'm glad i found your lectures, straight to the point and an understandable dialect.

  • @mobileappmike
    @mobileappmike Před 4 lety +1

    Good video. People say McDowell's lessons aren't important and are never used outside of interviews, but big O notation is actually important. I learned this the first time I used nested for loops.

  • @extremeloco23
    @extremeloco23 Před 6 lety +53

    Clicked this because it was 8 mins, straight to the point, no unnecessary knowledge. Loved it

    • @Ankit-zu2kp
      @Ankit-zu2kp Před 6 lety +7

      Yeah, I just hate to watch those one hour long explanations.

  • @Dmasha28
    @Dmasha28 Před 5 lety +23

    This makes me realize Colt Steele's a legend. I came here after watching his tuts on big O and I was surprised at how much I already knew

  • @Wiejeben
    @Wiejeben Před 7 lety +7

    Thanks for giving an explanation that someone without much knowledge of maths understands by giving practical examples :-)

  • @changeorbeextinct
    @changeorbeextinct Před 5 lety +48

    Great explanation of Big(O). This is important for any programmer to understand the efficiency of the algorithm.
    I know many excellent programmers who don't have CS degrees and may not know the academic description of Big(O). But they know it intuitively through experience. Having said that Bg(O) is an easy concept to understand, requires practice to know how to assess efficiency and scalability of the code.

  • @user-gp8fr1nd3w
    @user-gp8fr1nd3w Před 4 lety +160

    oh my god for the first few minutes I thought it is an ad.

  • @volo7
    @volo7 Před 6 lety +3

    that introduction really helped put this subject into perspective

  • @marie2136
    @marie2136 Před 5 lety +3

    Wow, Thank you sooo much!
    This video helped me a lot for studying for my finals.

  • @Owen-
    @Owen- Před 6 lety +4

    HOLY SHIT, THANK YOU SO MUCH. So wish you were my lecturer cause this made so much more sense than anything he ever said!

  • @shehrozeshahzad581
    @shehrozeshahzad581 Před rokem

    The best video after spending hours I finally understood the big O!Thanks

  • @vishalsoni6409
    @vishalsoni6409 Před 2 lety +1

    Excellent explanation! Thanks for simplifying Big O concepts.

  • @matexxo4004
    @matexxo4004 Před 6 lety +1

    I've studied many ressources on that subject, but it's finally on yours that I got the concept. Cheeeeeeeeeeeeers!!

  • @calgary52
    @calgary52 Před 3 lety

    Such a great explanation. I can flip a string with xor but I couldn't get Big O for the life of me. The meaningless N got me so confused before. Thank You!

  • @TheN0odles
    @TheN0odles Před 7 lety +9

    I'm from SA. I remember this 'exercise'. My brother even did a cartoon about it :-)
    Anyway, good explanation. Thanks.

  • @NooglerNafiz
    @NooglerNafiz Před 2 lety

    Such a revolutionary explanation of Big O.

  • @MrMukulpandey
    @MrMukulpandey Před 2 lety

    Wtf.....watched so many videos to understand this concept....and here u are explaining the same topic in an easy way...❤️❤️

  • @jeanliu6762
    @jeanliu6762 Před 5 lety

    A very concise and to-the-point video. Thanks!

  • @swissmatteo
    @swissmatteo Před 5 lety +21

    Even though I've had to survive from programming for all sorts of clients for almost 15 years, I now find myself having to learn these things if I want to settle down, get a job with a six figure salary. Truly nothing wrong with this, even though I've been told that I'm not a senior programmer. Which is correct, but I'm a senior in relationship development, sales, customer support, tolerance, fixing programming issues, doing whatever it takes to get the job done, and building real world applications. It's hard to tell an interviewer that has no real world experience these things without telling them to F off.
    I've disregarded my big Ego, and have been studying these things, taking online courses for Golang, and I now feel more confident that I can compete with my vocabulary and understanding of the computer science mumbo jumbo. It's truly an exciting step because after you learn just the bits and pieces, you indeed put yourself in a position to earn a wonderful living as a programmer.
    Wish you all the best of luck on your endeavors.

    • @PauloHenrique-pk5ro
      @PauloHenrique-pk5ro Před 2 lety

      How you doin' mate

    • @swissmatteo
      @swissmatteo Před 2 lety +1

      ​@@PauloHenrique-pk5ro Absolutely phenomenal. 2022 brought along with it some new experiences and opportunities. And yourself?

    • @PauloHenrique-pk5ro
      @PauloHenrique-pk5ro Před 2 lety

      @@swissmatteo I feel happy for you!
      I'm just an 18yo Beginner studying Basis Concepts to start Programming... Also trying my way to college, I'm nobody, yet. 😅
      Care to share your GitHub Profile?

    • @user-xn6jm1gz7l
      @user-xn6jm1gz7l Před 2 lety

      Absolutely mate i hope you're doing well!

  • @sindhusasidharan6762
    @sindhusasidharan6762 Před 2 lety

    Thank You for this video. I reached here after checking many other links .This is the best .

  • @chris9300
    @chris9300 Před 6 lety

    I enjoyed this. As a person who didn't have a background in Math or CS, this was very understandable. Now, I just need to remember and practice.

  • @awaisn
    @awaisn Před 5 lety

    i need this type of teaching. Fun, understandable and useful.

  • @kaieden
    @kaieden Před 7 lety +15

    The pigeon/Internet anecdote bears a striking resemblance the plot of Terry Pratchett's 'Going postal'

  • @jessicalaursen1790
    @jessicalaursen1790 Před 5 lety

    Straightforward. Easy to understand. Cool graphics! Hats off =)

  • @jordi5316
    @jordi5316 Před 3 lety +1

    i love this woman, she helped me so much

  • @stephenday4834
    @stephenday4834 Před 2 lety

    This is a wonderfully clear explanation.

  • @srinivasnangunuri1313
    @srinivasnangunuri1313 Před 7 lety +21

    Love your Graphics and Colors that are used for the Demonstration . makes it interesting to watch .

  • @stefanleoussis
    @stefanleoussis Před 2 lety +1

    I really love this video, they really did a great job here.

  • @KJ16ish
    @KJ16ish Před 6 lety

    Really creative explanation for solidifying our basics. :)

  • @loganthompson7461
    @loganthompson7461 Před 3 lety

    You had to be an amazing note taker in school. Thanks for the explanation

  • @ThiruSings
    @ThiruSings Před 7 lety

    Finally I understood Big O - Thanks a ton !!

  • @inframatic
    @inframatic Před 6 lety

    I have seen this and read Cracking the Coding Interview 6 and this explanation is far far far superior, but the book explains O(log N) and more complex algorithms

  • @francisaiello6197
    @francisaiello6197 Před 5 lety +4

    Gayle - I'm curious what tool you used for drawing the various slides. Looks like it might be a freehand drawing tool and looks great.

  • @tekamanurag6065
    @tekamanurag6065 Před 2 lety

    This is what I needed to level up thank you soo much.

  • @anikdas7434
    @anikdas7434 Před 6 lety

    best lecture i have seen so far

  • @Yetipfote
    @Yetipfote Před 5 lety

    props to the bumpy pigeon animation. I had a good chuckle. Also very good explanation

  • @supastar25
    @supastar25 Před 4 lety

    Thank you sooo much for this...so to the point and simplified

  • @msesbreno
    @msesbreno Před 3 lety +4

    Big O explained using a pigeon! What the heck! It’s so simple yet so effective that I want to cry. Thank you, Gayle! You are a gift to all programmers!

  • @subhamengine1143
    @subhamengine1143 Před 3 lety

    fav video for the concept..
    gonna recommend to all my juniors.

  • @santoshsco
    @santoshsco Před 2 lety

    Thats a great explanation , supercrisp and helpful for interviews .

  • @TheGoldenHawkz
    @TheGoldenHawkz Před 4 lety

    Love your video! very clear and concise

  • @latedeveloper7836
    @latedeveloper7836 Před 2 lety +7

    1:35 Describing the pigeon transfer speed in Big O notation
    2:00 What Big O is as an equation - scales linearly with respect to the amount of input
    2:10 Summary of Big O
    4:35 4 important rules for Big O Notation
    4:40 Why Big O is related to factorial (I think)

  • @rishikeshsarangi1245
    @rishikeshsarangi1245 Před 4 lety

    Thanks , the concepts are now clear , time to solve questions

  • @vincentbuscarello1357
    @vincentbuscarello1357 Před 7 lety +210

    Very strong overall explanation. What are the chances of getting a video showing some real world giveaways for more complex Os, like O(log N) etc?

  • @gabrielpereiramendes3463

    Very Good. Thanks from Brazil!

  • @elenegulordava1868
    @elenegulordava1868 Před 7 lety

    Great explanation! Easy way to get it.

  • @saisaketh7243
    @saisaketh7243 Před 5 lety

    Amazing explanation!! Please post more videos..

  • @kris4117
    @kris4117 Před 3 lety

    Well explained about representing O as a function of N under different scenarios.

  • @daramolapraise
    @daramolapraise Před rokem +1

    “DON’T BE LAZY!!!” is right. I was lazy for my Google interview because of the low stakes (I already have a job I am happy with) and fumbled almost every BigO question. It came up in every round. I knew which was faster intuitively, but found it hard to represent the correct notation. Learn this as it is very very important to fully grasp it. Also, know the BigO notations for most of the built in functions for your chosen language.

  • @Michael-AC
    @Michael-AC Před 2 lety +18

    Me: Man, I'm so confused by this class. What the heck is Big O?
    Gayle: Let's talk about one of my FAVOURITE things!
    Me: *feels even worse about struggling*

  • @MrMrWazzaa
    @MrMrWazzaa Před 4 lety +17

    HackerRank: Hi, Im Gayle Laakmann McDowell, author of Cracking the Coding Interview.
    me: i am aware

  • @allenllewellynkra
    @allenllewellynkra Před 6 lety

    Best explanation I've seen

  • @Fan-fb4tz
    @Fan-fb4tz Před 3 lety

    This is the clearest intro on Big O

  • @krissaurixsent7988
    @krissaurixsent7988 Před 2 lety +1

    Great video, good theme the big O notation is very interesting

  • @haoyuli6006
    @haoyuli6006 Před 6 lety

    Thanks so much, its life-saving

  • @mikeromani608
    @mikeromani608 Před 6 lety

    Great explanation, thanks!

  • @vishvedula1
    @vishvedula1 Před 7 lety +3

    Well explained, thanks :)

  • @milindbebarta2226
    @milindbebarta2226 Před 4 lety

    Very good explanation. Subbed!

  • @AlexLaird7
    @AlexLaird7 Před 7 lety

    Great explanation, thank you

  • @haitham5104
    @haitham5104 Před 5 lety

    thank you for the clear explanation

  • @sumitkumar-el3kc
    @sumitkumar-el3kc Před 4 lety

    Thank you, it was really helpful.

  • @ritickmadaan
    @ritickmadaan Před 4 lety

    Its a really helpful video, made the concept pretty clear the only one thing is that it would have been better if an example of O(log(n)) would have also been there

  • @akhilk5121
    @akhilk5121 Před 7 lety +4

    Great colors!😊

  • @tmustafad
    @tmustafad Před 6 lety

    amazing explanation. thank you

  • @shawnmofid7131
    @shawnmofid7131 Před 2 lety

    I loved the story as well as the explanation. I also knew the pigeon is going to win:-)

  • @momentouscrazynoob1709

    thank you! It really cleares stuff up :D

  • @DarianBenam
    @DarianBenam Před rokem

    Really good explanation!

  • @rahulbajaj2639
    @rahulbajaj2639 Před 5 lety +1

    Thanks a lot, very informative :)

  • @MPKDilshan
    @MPKDilshan Před 11 měsíci

    Thank you and it is really helpful.

  • @deepakp2641
    @deepakp2641 Před 6 lety

    Great explanation!

  • @mayank_upadhyay_19
    @mayank_upadhyay_19 Před 4 lety +5

    Once, I used to thought that algorithm efficiency is not going to be a problem for me.
    ***believe me, I learned the lesson, hard way***

    • @hopeklein6537
      @hopeklein6537 Před 4 lety +1

      How d'you find out? What d'you encounter?

  • @nipunasudha
    @nipunasudha Před 5 lety

    nice refresher, thanks

  • @nandatkumar
    @nandatkumar Před 7 lety

    Just Great Explanation..

  • @sohamde4392
    @sohamde4392 Před 7 lety

    Thanks, great explanation :)

  • @darsul3200
    @darsul3200 Před 5 lety

    A simple thank you!

  • @ll-sz9fl
    @ll-sz9fl Před 4 lety +1

    Thank you very much, better than my CS PhD. Professors.

  • @stoopydmynd
    @stoopydmynd Před 3 lety

    Finally a good explanation! Couldn't understand it with my lazy ass teacher... Thank you!

  • @thewall07
    @thewall07 Před 5 lety

    Amazing video!

  • @CyberGenious24
    @CyberGenious24 Před 7 lety

    Thanks for clear explanation ..

  • @JonathanMontgomery77
    @JonathanMontgomery77 Před 4 lety +32

    We need some O(log n) and O(n log n).

  • @JagjotSingh
    @JagjotSingh Před 5 lety +3

    I studied this in my CS course 15 years back. After that I never got a chance to use it in practice.

  • @fayazrahman731
    @fayazrahman731 Před 7 lety

    Good explanation. Thanks. :)

  • @CaseyMartin
    @CaseyMartin Před 2 lety

    I appreciate the bird moving at the end. Fun touch.

  • @arthurmazzi841
    @arthurmazzi841 Před rokem

    Very nice video!

  • @cosmopix9075
    @cosmopix9075 Před 6 lety

    just what I needed

  • @NuisanceMan
    @NuisanceMan Před 5 lety +42

    3:20 Always good to see someone who knows how to draw a square...

    • @hanats
      @hanats Před 4 lety

      it is a square, just not drawn to scale.

    • @FeLiNe418
      @FeLiNe418 Před 4 lety +1

      perspective

  • @leohaldan4915
    @leohaldan4915 Před 5 lety

    nice examples thank you

  • @nanophyr_4468
    @nanophyr_4468 Před 3 lety

    Nice point to highlight at 6:23 .. it's small but I caught out doing this in an interview before.

  • @orochinagi1111
    @orochinagi1111 Před 7 lety

    great video thank you!

  • @alexisribeiro2611
    @alexisribeiro2611 Před 4 lety

    The easiest explanation about Big O in the internet so far.

  • @romelsouza4288
    @romelsouza4288 Před 10 měsíci

    Thank you so much!

  • @mrrock3679
    @mrrock3679 Před 6 lety

    I've noticed the books in the background were written each one in the different language, so I can suppose you read/listen/speak two or three idioms besides the English, right?

  • @gustavopacheco7573
    @gustavopacheco7573 Před 11 měsíci

    Great video