Hey everyone. In this video, I’m going to give you an introduction to Big O notation and time complexity. These concepts basically give you one way of describing how the time it takes to run your function grows as the size of the input grows. To see what I mean by that exactly, let’s take a look at a few examples here. First of all, let’s say you are given an array like this and let’s say that this array could be of any lengths. It could be one hundred elements long, a thousand elements long or even one hundred thousand elements. And let’s say you want to write a function that takes this array and returns the sum of all the numbers in this array. So, in your function you wanna add up all the numbers of this array and returns the sum. And that function might look like this function right here and I’m gonna use pseudocode here to write this function. So, first of all let’s define our function that gonna be called find sum which is going to take given array as input and then inside this function first of all we gonna initialize a variable called total to 0 and then for each i in this given array or for each number total to 0

Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)

100 thoughts on “Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7)

  • June 26, 2019 at 4:31 pm
    Permalink

    Hi, have you seen the Berlekamp–Massey algorithm? The time complexity is defined as O(n^2), where n is the input data. Can I asume the same space complexity?

    Reply
  • June 28, 2019 at 5:16 am
    Permalink

    Thank you so much for explaining this. I have a quiz on Big O analysis tomorrow and I was completely lost before watching this video.

    Reply
  • June 29, 2019 at 6:47 pm
    Permalink

    really nicely done with painstaking detail and examples – thank you

    Reply
  • July 1, 2019 at 12:56 pm
    Permalink

    Thanks man u made my day! I was stuck at this topic at my college and u made it easy for understanding. Please make more videos on data structures.

    Reply
  • July 7, 2019 at 11:47 am
    Permalink

    17:41 – how to find time complexity

    Reply
  • July 7, 2019 at 9:30 pm
    Permalink

    This is by far the best explanation about such topic. Really thanks!

    Reply
  • July 8, 2019 at 6:13 pm
    Permalink

    I really request you for the BigO video. Please do…

    Reply
  • July 13, 2019 at 12:03 am
    Permalink

    Excellent!!

    Reply
  • July 14, 2019 at 5:11 am
    Permalink

    I just want some more video on this topic🙌💯
    Great explaination YK👍

    Reply
  • July 17, 2019 at 2:22 am
    Permalink

    It's a shame for me that I have worked with various types of projects but I don't know basic things like this, thank you, you just made my day! 🙂

    Reply
  • July 17, 2019 at 12:01 pm
    Permalink

    perfection for a beginner 👌

    Reply
  • July 18, 2019 at 8:34 am
    Permalink

    The mathematical rigorous explanation of Big O Notation would be much appreciated, brother. Thank your for the videos. 😀

    Reply
  • July 18, 2019 at 2:34 pm
    Permalink

    INCOMPLETE
    Don't waste 36 mins

    Reply
  • July 26, 2019 at 1:15 am
    Permalink

    I was about to Google Big O Notation when this video appeared in my recommendation and it clears out everything!! Many Thanks!

    Reply
  • July 28, 2019 at 4:37 pm
    Permalink

    This is an amazing series man. You really explain soo good. Want to learn everything from you. Lots of love from India 😍😍

    Reply
  • July 31, 2019 at 4:13 pm
    Permalink

    This just might save my sem.

    Reply
  • August 1, 2019 at 5:49 am
    Permalink

    Thanks a lot this was great. Would be perfect if there was a 6min version of this, kinda wordy and you lost me many times .

    Reply
  • August 2, 2019 at 8:14 pm
    Permalink

    YK, just wanted to say how much I appreciate you for dedicating your valuable time and knowledge to the youtube community of developers. I am starting out fresh as a software developer and CS major this fall. Your videos are excellent learning tools are are helping me to grasp the discipline so thanks man!

    Reply
  • August 3, 2019 at 9:19 am
    Permalink

    T = c1 * n^2 + c2 * n^2 what will be the Time complexity?

    Reply
  • August 5, 2019 at 5:18 pm
    Permalink

    Superbbb great

    Reply
  • August 6, 2019 at 7:06 am
    Permalink

    CS Dojo,
    Can you make video on binary tree and avl tree and heap?

    Reply
  • August 6, 2019 at 7:54 pm
    Permalink

    If all elements enqueued and all elements dequeued in circular queue then front=0 and rear = size-1 which is the condition of full queue but it is empty .why???

    Reply
  • August 15, 2019 at 1:45 pm
    Permalink

    Thanks a lot, YK, you are such a good lecturer, i learned more here than my graduate classes!

    Reply
  • August 16, 2019 at 10:27 am
    Permalink

    Awesome ! Thank you for the video

    Reply
  • August 16, 2019 at 12:44 pm
    Permalink

    Is this an okay way to implement the find_sum_2d function in python?

    def find_sum(arr):

    total=0
    for i in range(len(arr)):

    for j in range(len(arr[i])):

    total+=arr[i][j]

    return total

    let me know if theres an easier way

    Reply
  • August 19, 2019 at 6:11 am
    Permalink

    You are soooo good i can see why Google hired you. Thanks for the explanation. It is been a while since i needed to remember all of this and it just pops in my mind when you explain it like that.

    Reply
  • August 21, 2019 at 9:12 am
    Permalink

    Thanks!

    Reply
  • August 21, 2019 at 12:26 pm
    Permalink

    Awesome explanation! Love this

    Reply
  • August 22, 2019 at 1:31 pm
    Permalink

    This video is still understandable in 3x speed, and barely understandable in 4x speed. You really ought to talk faster, or to upload the video at an edited speed. The best speed I found was 2.5x

    Reply
  • August 23, 2019 at 11:06 pm
    Permalink

    This video is a gem

    Reply
  • August 24, 2019 at 3:43 am
    Permalink

    Big backch00di ha. Yee too.🤔 😤

    Reply
  • August 25, 2019 at 8:40 pm
    Permalink

    python is worse than pseudocode. there i said it. grabs popcorn

    Reply
  • August 28, 2019 at 6:09 am
    Permalink

    What tool is being used to do the live illustrations and click-to-show coding? Thanks.

    Reply
  • August 28, 2019 at 5:00 pm
    Permalink

    Very good. Thanks!

    Reply
  • August 28, 2019 at 6:08 pm
    Permalink

    Hey Dojo, it was pretty nice explaination looking for more videos on algo and ds..

    Reply
  • August 31, 2019 at 5:27 am
    Permalink

    Is finding the fastest growing term actually the limit of function T when n goes to infinity?

    Reply
  • September 1, 2019 at 8:03 am
    Permalink

    How do I calculate while loop?

    Reply
  • September 3, 2019 at 7:51 pm
    Permalink

    Thank you for this video, I will be keeping up to date with you data structures class just as some extra help as I just started data structures class and want to learn as much as possible

    Reply
  • September 4, 2019 at 1:58 pm
    Permalink

    Excellent dude, I wish, I would have a teacher like you.

    Reply
  • September 5, 2019 at 4:39 am
    Permalink

    THANK YOU FOR THIS VIDEO CANT UNDERSTAND MY PROFESSOR BUT BRO YOU NAILED IT!

    Reply
  • September 5, 2019 at 5:49 pm
    Permalink

    Excellent explanation

    Reply
  • September 6, 2019 at 6:34 am
    Permalink

    14:41 if you're removing all the coefficients then the 1 will also be removed.Instead of that you may write the function as
    0.115 * x to the power 0 so that variable x remains according to the rule(anything to the power zero is 1).

    Reply
  • September 9, 2019 at 12:02 pm
    Permalink

    we wait more about Algorithm and DataStructure from you and thanks for your effort and your simple way

    Reply
  • September 12, 2019 at 3:13 pm
    Permalink

    is this part of measuring complexity

    Reply
  • September 13, 2019 at 7:32 am
    Permalink

    i got a book
    which is very expensive in my country
    some bunch of experts and phds wrote it

    trust me , the book is just bunch of shittiest explanations i have ever seen

    now i feel you taught me this for free
    and its blessing for me

    Reply
  • September 13, 2019 at 1:51 pm
    Permalink

    Thank you ♡♡♡

    Reply
  • September 14, 2019 at 8:55 am
    Permalink

    Helpful presentations however the empty boxes you show are kind of annoying. It's better when one can look at the entire code in a glance.

    Reply
  • September 14, 2019 at 2:10 pm
    Permalink

    It's clear you know this material, but you spend far too much time tediously explaining the same things over and over. This could easily have been 10 minutes or less.

    Reply
  • September 16, 2019 at 5:43 pm
    Permalink

    I wasted my tuition fees.

    Reply
  • September 17, 2019 at 5:05 pm
    Permalink

    Why did you call that array 2D when it contained 3 arrays? Isn't that supposed to be 3D? Sorry for the noob question…

    Reply
  • September 18, 2019 at 1:58 pm
    Permalink

    Thanku very much such a nice explanitaion ..day after tomorrow is my exam and now the concept are getting clear 😀😀😄😃🤟🏻

    Reply
  • September 18, 2019 at 5:17 pm
    Permalink

    👍👍

    Reply
  • September 19, 2019 at 1:35 am
    Permalink

    Makasih kk

    Reply
  • September 19, 2019 at 11:22 pm
    Permalink

    谢谢小哥哥讲解!很清晰!

    Reply
  • September 20, 2019 at 7:44 am
    Permalink

    24: for loop runs n+1 times wouldn't that be written n+1*O(1)?

    Reply
  • September 21, 2019 at 5:23 am
    Permalink

    Excellent video!. I love the way you narrated the Big O Notation and Time Complexity with good examples. Thanks!

    Reply
  • September 21, 2019 at 2:30 pm
    Permalink

    It helped. KIU.

    Reply
  • September 22, 2019 at 5:27 am
    Permalink

    I want to find Big-O notation complexity step by step…Anyone help me …?

    Reply
  • September 22, 2019 at 5:27 am
    Permalink

    I've to complete my assignment…right now

    Reply
  • September 22, 2019 at 9:58 am
    Permalink

    I wish this series could continue forever. 30 minutes of CS Dojo teaches more efficiently than all the classes at my university combined.

    Reply
  • September 24, 2019 at 3:38 am
    Permalink

    ok this video makes me subscribe this channel.

    Reply
  • September 27, 2019 at 5:32 am
    Permalink

    A very good and detailed explanation of Big O notation and time complexity. I'm a college student and I took Data Structure course before but the professor was suck so that I end up did not learn any knowledge about Data Structure. After I watched this video, I really hope that you were my professor at the time that I was learning Data Structure. Excellent video.

    Reply
  • September 29, 2019 at 1:58 pm
    Permalink

    If only had x1.5 speed in real life lectures

    Reply
  • September 29, 2019 at 2:11 pm
    Permalink

    22:30 isn't the for loop O(N)

    Reply
  • September 29, 2019 at 7:25 pm
    Permalink

    Love all ur vids!💜

    Reply
  • September 30, 2019 at 6:12 am
    Permalink

    need to learn this an interview, best decision to click on this video

    Reply
  • October 1, 2019 at 6:36 am
    Permalink

    {}{}{}{{{{}}{{}}}}}😑

    Reply
  • October 1, 2019 at 8:03 am
    Permalink

    lol oooookay slow down their Asian kid. really living up to that stereotype

    Reply
  • October 3, 2019 at 6:23 pm
    Permalink

    very nice explained!

    Reply
  • October 4, 2019 at 4:55 am
    Permalink

    Have an exam tomorrow. It will have some Big O, I feel so much better about it after this video. Thank you so much.

    Reply
  • October 4, 2019 at 8:14 pm
    Permalink

    CS Dojo, you need to create your own MOOC or something. I swear to god, I would drop cash to buy your course. You explain everything so succinctly and clearly. You are god-tier at explaining this stuff. I WILL GIVE YOU MONEY!!

    Reply
  • October 5, 2019 at 1:45 am
    Permalink

    老公,我太可以了吧

    Reply
  • October 6, 2019 at 7:28 pm
    Permalink

    Great tutorial! Very Helpful! The Instructor is very knowledgeable about the subject and presents the information very clear and concisely, more youtube tutorial presenters should learn to focus on this style presentation format. Thank you for this very helpful video! Sub/d!
    {{ : ]__~~ robogenus }}

    Reply
  • October 8, 2019 at 2:02 pm
    Permalink

    Love you homie 🙏🏿

    Reply
  • October 10, 2019 at 1:58 am
    Permalink

    naming the functions
    people: SumOfArray
    CSdojo: StupidFunction.

    Reply
  • October 13, 2019 at 2:53 am
    Permalink

    as you do, to make those grids of your black background video. in general how are you doing?

    please.

    Reply
  • October 13, 2019 at 5:10 pm
    Permalink

    CAST IN THE NAME OF GOD, YE NOT GUILTY

    BIG O, ACTION!!!

    Reply
  • October 13, 2019 at 5:46 pm
    Permalink

    Thanks for the great video. Would be nice to decrease the number of ads though!

    Reply
  • October 15, 2019 at 11:39 pm
    Permalink

    Thank you

    Reply
  • October 16, 2019 at 12:38 pm
    Permalink

    sir if 2D array elements are not of same length then how can we find big o?

    Reply
  • October 20, 2019 at 10:45 am
    Permalink

    I am not a computer science student, I have been struggling to understand BIG O Notation for month, this solve this in the simplest best of way. thanks a million

    Reply
  • October 20, 2019 at 1:47 pm
    Permalink

    Too Good

    Reply
  • October 20, 2019 at 6:10 pm
    Permalink

    Hey , did you know your video was used here – https://www.youtube.com/watch?v=T2sFYY-fT5o ? I was shocked …

    Reply
  • October 20, 2019 at 7:43 pm
    Permalink

    OMG! That was an amazing tutorial. Thank you so much

    Reply
  • October 21, 2019 at 9:14 pm
    Permalink

    I‘m bit of confused. The for-loop part, in my textbook, shows it takes 2n ops. Also, for those operations,such as Variable = 10, takes 2 ops. Would you mind describing it a bit more? Thanks a lot

    Reply
  • October 23, 2019 at 4:13 am
    Permalink

    Great video! It would have been even better if you provided new code for T_4 -; to clarify exactly the way the code was structured .

    Reply
  • October 23, 2019 at 2:02 pm
    Permalink

    wow u are good at explaining things nice and love it

    Reply
  • October 24, 2019 at 4:58 pm
    Permalink

    please do a mathematical explanation video!!! really appreciate what u have done here!

    Reply
  • October 25, 2019 at 12:26 pm
    Permalink

    **GOD level explanation**

    Thank you very much!

    Reply
  • October 25, 2019 at 6:05 pm
    Permalink

    Having an exam with big o today and your vid saved me . 🙏🙏🙏

    Reply
  • October 26, 2019 at 12:43 pm
    Permalink

    Thank you so much! I learned so much from this video!

    Reply
  • October 28, 2019 at 5:40 pm
    Permalink

    Wow that helped so much, thank you – I am glad I took the time to watch it!

    Reply
  • October 31, 2019 at 5:36 pm
    Permalink

    My internet charge is recovered after watching this video

    Reply
  • November 1, 2019 at 10:22 pm
    Permalink

    Awesomeness, nest explanation I have seen.

    Reply
  • November 2, 2019 at 9:37 am
    Permalink

    Really awesome explanation.
    I learned a lot from you.
    Thank you

    Reply
  • November 3, 2019 at 2:47 pm
    Permalink

    Wait .. where did A and B come from? What do they represent? It was never explained.

    Reply
  • November 4, 2019 at 2:20 pm
    Permalink

    Thanks for the amazing video, I appreciate it a lot. I have one question: when you were adding to the total you were doing total += i . This would add the indexes from the array to each other, not the values. Shouldn't it be total += array[i] ?

    Reply
  • November 5, 2019 at 6:33 am
    Permalink

    Plz upload the videos of theta notation & omega notation

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *