How to Prove or Disprove Big-O - Introduction to Computer Science

Sdílet
Vložit
  • čas přidán 6. 10. 2023
  • In this video, I will show you how to prove or disprove Big O. I will also go over the formal definition of the formula Big O using asymptotic notation to determine the runtime of an algorithm. For example, you are asked to prove that a function 2n+3 is O(n). By the definition of big O, f(n) is O(g(n)) if you can find a positive constant c and a positive integer nₒ such that f(n) is less than or equal to c times g(n), for all n is greater than nₒ.
    Knowing how to prove that something is Big O or not Big O is an important skill that Computer Science CS and Math students need to know about time complexity and growth of functions. It is likely that you will encounter this topic in your typical Data Structures, Discrete Mathematics, or Analysis of Algorithm courses at University.
    I will also how you how to prive Big Omega Ω or Big Theta θ. If you enjoyed this video, please don't forget to comment down below and also subscribe if you haven't already!

Komentáře • 50

  • @SN-ow1bp
    @SN-ow1bp Před 8 měsíci +13

    youre the best tutor in the game for computer science & math, please don't stop making these videos

    • @QuocDatPhung
      @QuocDatPhung  Před 8 měsíci +3

      Thanks very much! I will never stop making videos :)

  • @garubahabeeb1013
    @garubahabeeb1013 Před 12 dny +1

    This video was great, really liked the way you simplified each step and made it easy to understand 👍

    • @QuocDatPhung
      @QuocDatPhung  Před 7 dny +1

      Thank you Garu! Please kindly share with your friends and subscribe to support me ~ you can find all of my CS videos in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @mes2914
    @mes2914 Před 6 měsíci +8

    So much helper than a lecture in colleage,much straightforward,i will recommend to my classmate,thanks!!!

    • @QuocDatPhung
      @QuocDatPhung  Před 6 měsíci +1

      Thanks so much! Please also kindly subscribe! You can find all of my Data Structures and Algorithm lessons in this playlist: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

    • @nandor2329
      @nandor2329 Před 4 měsíci +1

      Abssolutely agree, what a man, Thanks !!!

  • @purifynature8479
    @purifynature8479 Před 9 měsíci +5

    Thank you so much! This is what I was looking for.

  • @punditgi
    @punditgi Před 9 měsíci +7

    Excellent video! 🎉

  • @misspps_
    @misspps_ Před 3 měsíci +1

    1.50 mins and I'm finally understand the concept. Thank you so much!

    • @QuocDatPhung
      @QuocDatPhung  Před 3 měsíci +1

      I'm glad it was helpful! You can find the Big Ω video here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @shuyao5248
    @shuyao5248 Před 24 dny +1

    finally well understand. Thank you very much

    • @QuocDatPhung
      @QuocDatPhung  Před 24 dny +1

      Thank you for your kind words Shuyao! Please kindly share with your friends and subscribe ~ all of my CS videos are in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @m3ga975
    @m3ga975 Před 5 měsíci +1

    Than you so much you made it so easy to understand how to do the formal way.

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +2

      Thanks so much M3ga! I will try to work on Big Omega and Big Theta once I finish my exams haha. Please don't forget to subscribe! As well, you can find all of my Data Structures & Algorithms videos in this playlist: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @josephsena5963
    @josephsena5963 Před měsícem +1

    This was really helpful, thank you

    • @QuocDatPhung
      @QuocDatPhung  Před měsícem +1

      You're welcome Joseph! Please kindly share and subscribe~ you can find all of my CS videos in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @user-pk9ov6ek2b
    @user-pk9ov6ek2b Před 4 měsíci +1

    Bro, I have an exam in couple of days and you saved me, may god bless you

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      Thank you! Don't forget to see my video on Big Omega! You can find the link here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @Pasquiz_
    @Pasquiz_ Před 4 měsíci +1

    Thank you very much for making me understand this thing!!!😭

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      You're very welcome! You can find all of my CS videos in this playlsit: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @liu.qiandao4194
    @liu.qiandao4194 Před 4 měsíci +2

    that's what im looking for man!

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      I'm glad it helped! You can find all of my Computer Science videos here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @austinscott4695
    @austinscott4695 Před 4 měsíci +1

    Thank you!

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      You're welcome! You can find all of my CS videos in this playlist (don't forget to share and kindly subscribe!): czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @Rootoo000
    @Rootoo000 Před 5 měsíci +1

    What a great channel !!😮💓💓

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +1

      Thanks so much! You can find all of my CS videos here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @nomnaday
    @nomnaday Před 5 měsíci +1

    cảm ơn bạn ơi

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +2

      Không có gì bạn! Bạn có thể tìm tất cả clip của mình về Computer Science trong link này nhé (bạn đừng quên chia sẻ và đăng kí hihi): czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @Simple-M___zzz
    @Simple-M___zzz Před měsícem +1

    thank yooooou

    • @QuocDatPhung
      @QuocDatPhung  Před měsícem +1

      You're welcome Muhammed! Please kindly share and subscribe~ you can find all of my CS videos in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @etcetera7529
    @etcetera7529 Před 5 měsíci +1

    super video

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +1

      Thanks so much! You can find all of my CS videos in this link here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @suteguma0
    @suteguma0 Před 4 měsíci +1

    bro is the GOAT

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      Thanks so much Thiên Phúc! I'm working on the one for Theta and Omega; you can find all of my CS videos in this playlist here (don't forget to share and kindly subscribe!): czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @WolkenDesigns
    @WolkenDesigns Před 3 měsíci +1

    Hi thank you for your video. To prove big Theta, do I have to prove big O and big Omega and if both are true big Theta is proved?
    Also could you tell me following:
    The way to find a constant c, we are choosing the one that we are trying to proove (for example xxx = O(n²). So on the right side of "is larger or equal than) all of the values will have to be larger than on the left side but max. as n².
    What happens if we cannot choose a larger one by this definition? So if it is
    100n³ = O(n²) we cannot choose n² as the largest.
    Many thanks from Germany!!

    • @QuocDatPhung
      @QuocDatPhung  Před 3 měsíci +1

      I actually have videos on Big Omega/Theta! You can find it here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @imjuszay1470
    @imjuszay1470 Před 4 měsíci +1

    For the 5n^2 + 3nlogn + 2n + 5 is O(n^2)
    I got constant C = 12 because instead of raising nlogn to n^2 I just dropped it all together
    5n^2 + 3nlogn + 2n + 5

    • @QuocDatPhung
      @QuocDatPhung  Před 4 měsíci +1

      Yes that should be fine :) You can find all of my CS videos here: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @isaiahle9450
    @isaiahle9450 Před 3 měsíci +1

    Hi could I ask what n not is? In our class we use C and K but I find your method to be easier.

    • @QuocDatPhung
      @QuocDatPhung  Před 3 měsíci +1

      N not is the same as k :) some textbooks use different variables but they mean the same thing! Also I'm really glad to hear that you find my method easier! I would really appreciate if you could kindly share or subscribe ~ you can find all of my CS videos in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @mahrbooiiii
    @mahrbooiiii Před 2 měsíci +1

    I love you

    • @QuocDatPhung
      @QuocDatPhung  Před 2 měsíci +1

      Thank you! I have videos on Big Theta and other topics too! Pls don't forget to share with your classmates and kindly subscribe ~ you can find all of my CS videos in this link: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @seketorianGaming
    @seketorianGaming Před 5 měsíci +1

    howd you get 2n + 3n

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +1

      Hi Timmy, please let me know the timestamp of the question you're referring to.

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +1

      Do you mean the one at 1:12? Ok, now imagine you're in a math class. Let's say you have f(x) = x and g(x) = x^2. Since g(x) is quadratic, and f(x) is linear, then it must be that g(x) > f(x) meaning g(x) will at some point intersect f(x) and be above it forever. Agreed? You can also pick g(x) = x^3 or whatever you want and g(x) is still greater than f(x). Now, coming back to 1:12, let's say f(x) = 2n + 3. Can we find a function greater than this one? Yes. We can say the function 2n + 3n or 2n^2 + 3 or whatever you want. But for the sake of simplicity, let's pick 2n + 3n. Therefore, you get 2n + 3 < 2n + 3n. Does that make sense? Don't overcomplicate it. It's easier than it looks.

    • @seketorianGaming
      @seketorianGaming Před 5 měsíci +1

      @@QuocDatPhung Thank you, this helped. And you're correct I think I over complicated it.

    • @QuocDatPhung
      @QuocDatPhung  Před 5 měsíci +1

      @@seketorianGaming No worries! You can find all of my Data Structures & Algorithms videos in this playlist: czcams.com/play/PLeTO6OT3-FKmuxOu4RtupTay1yrMp6QGC.html

  • @AbhishekVerma-kj9hd
    @AbhishekVerma-kj9hd Před 2 měsíci +1

    Don't you think c^n is bigger than n^c

    • @QuocDatPhung
      @QuocDatPhung  Před 2 měsíci +1

      Yes, in the video I said that c^n is bigger than n^c at 5:20