Big O Notation & Time Complexity Analysis Tutorial

Welcome back to another video! In this video I am going to be explaining Big O Notation, as well as how to do Time Complexity Analysis with various algorithms! I have a bunch of examples in this video and I really want to focus on those examples and how to do Time Complexity Analysis! I hope that you find this video helpful!
💻 ProgrammingExpert is the best platform to learn how to code and become a software engineer as fast as possible! Check it out here: programmingexpert.io/tim and use code "tim" for a discount!
⭐️ Timestamps ⭐️
00:00:00 | Overview
00:01:08 | What is Big O Notation?
00:03:35 | Big O Notation Explained
00:25:02 | Practice Question 0 (Easy)
00:26:26 | Practice Question 1 (Easy)
00:27:33 | Practice Question 2 (Easy)
00:31:36 | Practice Question 3 (Medium)
00:33:55 | Practice Question 4 (Medium)
00:36:55 | Practice Question 5 (Medium)
00:40:53 | Practice Question 6 (Medium)
00:43:33 | Practice Question 7 (Medium)
00:46:51 | Practice Question 8 (Hard)
00:51:22 | Practice Question 9 (Hard)
00:56:53 | Practice Question 10 (Hard)
01:00:13 | Practice Question 11 (Hard)
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
👕 Merchandise: teespring.com/stores/tech-wit...
📸 Instagram: / tech_with_tim
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-ruscica-82631b179
🌎 Website: techwithtim.net
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
🎬 My KZread Gear: www.techwithtim.net/gear/
💵 One-Time Donations: www.paypal.com/donate?hosted_...
💰 Patreon: / techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
⭐️ Tags ⭐️
-Tech With Tim
-What is Big O Notation?
-Big O Notation Explained
-Time Complexity Explained
-What is Time Complexity
⭐️ Hashtags ⭐️
#TechWithTim #BigONotation #TimeComplexity

Пікірлер: 93

  • @ginadouglas7641
    @ginadouglas76415 ай бұрын

    Never understood big o notation until I found this video. Thank you so much!!

  • @uncle-ff7jq
    @uncle-ff7jq2 жыл бұрын

    Genuinely informative, I really appreciate the breadth of your knowledge and how you use to to explain things in a concise way from multiple perspectives. Your content really helps me understand concepts I would've never thought I could grasp an understanding of and feel less intimidated about the learning process in general. Thanks!

  • @mrmillmill
    @mrmillmill2 жыл бұрын

    Fantastic video as usual Tim! Finishing up my first view of it. Thorough explanation. Would like to see 2-4 examples per any given inefficient algorithm and show how to make each more efficient in terms of Big O notation. Thank you for an incredible video.

  • @bluereino
    @bluereino2 жыл бұрын

    Actually helped me a ton! I was so lost when my professor was explaining it, but watching this gave me some clarity on the topic!

  • @kellenrivers5466
    @kellenrivers54662 жыл бұрын

    This is super helpful, Tim! I'm new to the field and have yet to have this concept explained in such a digestible manner. Working through ProgrammingExpert as well which it has been invaluable.

  • @s950343
    @s9503432 жыл бұрын

    Amazing video! Looking forward to watching more videos related to other data structure concept!!

  • @subramanianchenniappan4059
    @subramanianchenniappan40592 жыл бұрын

    Thanks . I am a java developer . This is useful for interview . Not many videos are there in youtube. and udemy on this topic

  • @noobypro4560
    @noobypro45602 жыл бұрын

    this what I wished for someone to make a good tutorial on big O notation Thank you so much Tim!

  • @alanmunoz3755
    @alanmunoz37552 жыл бұрын

    Thanks tim, I have been wating for these kind of videos (from you) for a while. Thank you

  • @16sumo41
    @16sumo41 Жыл бұрын

    love your content Tim! And this was indredibly enlightning. When I studied elementary number theory we talked about the big O notation but I always felt like I did not understand the point of having such a notation. Now, with these programming examples it feels much more intuitive and I can much clearly see the relevance of this notation.

  • @user-iy4tp2pi6m
    @user-iy4tp2pi6m5 ай бұрын

    Thank you so much! I've watched so many of your tutorials and they've helped me so much to where it's definitely worth subscribing to your ProgrammingExpert course!

  • @JulioDx3480
    @JulioDx34802 жыл бұрын

    Thanks for the thorough explanation and examples.

  • @sam1286
    @sam12862 жыл бұрын

    I just started learning Big O notation in class and this was so helpful!!

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

    Incredibly helpful video Tim! Thank you for all the practice questions and patiently explaining it to us! =)

  • @rishabhsubrahmanian112
    @rishabhsubrahmanian1122 жыл бұрын

    Let’s goooo big Tim! Thanks for the video yet again.

  • @foxsermon
    @foxsermon2 жыл бұрын

    I learned a lot from this video than 2 weeks of school.. great content 👍🏻 !!

  • @anuvabchakraborty4900
    @anuvabchakraborty49002 жыл бұрын

    Really excited to learn more

  • @kardasmanish1069
    @kardasmanish10692 жыл бұрын

    The explaination you give is impeccable

  • @siderealvictor9813
    @siderealvictor98132 жыл бұрын

    Man I was thinking to learn this topic yesterday and today you posted a video about big o notation WOW!

  • @gustavojuantorena
    @gustavojuantorena2 жыл бұрын

    Thank you Tim. Pretty important topic.

  • @BookOfMorman
    @BookOfMorman2 жыл бұрын

    Thank you! I needed this badly!

  • @loudarck2402
    @loudarck24022 жыл бұрын

    Good video Tim , watched like 4 or 5 video about Big O notation could't still perfectly get it until you did a video about it hope you do for other Notation

  • @juanfeliperenza1604
    @juanfeliperenza16042 жыл бұрын

    Amazingly explained

  • @Clipaholick
    @Clipaholick2 жыл бұрын

    Amazing tutorial fr, thanks Tim :)

  • @MishaSv
    @MishaSv2 жыл бұрын

    Amazing tutorial! Everything clearly explained and presented. This is a must watch video for everyone who is trying to start in the software engineering field as well as computer science!

  • @redstonebear
    @redstonebear2 жыл бұрын

    I needed this!

  • @mohammadkhalili1289
    @mohammadkhalili12892 жыл бұрын

    That was really helpful ♥️

  • @mrmillmill
    @mrmillmill2 жыл бұрын

    Would like to see more on the other time complexities and also more on all algorithms from easy to advanced and showing examples of when each can be used in real world situations

  • @yaboy7120
    @yaboy71205 ай бұрын

    taking data structures & algorithms in java this video is a blessing 🙏🏻thank you kind sir

  • @devxlk
    @devxlk2 жыл бұрын

    Amazing video! ❤❤❤

  • @ricardocambundo2527
    @ricardocambundo25272 жыл бұрын

    Appreciate it, dope video, really helped

  • @YotamBarakJAB271104
    @YotamBarakJAB2711042 жыл бұрын

    Thank you!!

  • @munizrobson5292
    @munizrobson52922 жыл бұрын

    Hey Tim Great Content as Always.✨ Thanks for Sharing it!🙏🏻 You Have Been an Inspiration for My Own 📺KZread Channel!!!

  • @scruffystudios8112
    @scruffystudios81122 жыл бұрын

    Loving this tutorial, really appreciate it :D I'm on question 7 right now, if we assume that starting input n > 0 then the function never ends as it gets down to n=1 which halves to 0.5 and rounds back to 1. I know this wasn't the point of the question, just something I noticed :')

  • @nandakishore9579
    @nandakishore95792 жыл бұрын

    Super explanation

  • @coderanger7708
    @coderanger77082 жыл бұрын

    This video is not good Tim...... It's GREAAAAT!!!!!!!!! The maths explanations were kinda funny at times but you nailed it. Big O was hard for me to understand to do it quick enough but you made it easy. Kudooos

  • @TheCodeDealer
    @TheCodeDealer2 жыл бұрын

    Coool video Tim!

  • @chikanmao8326
    @chikanmao83262 жыл бұрын

    Thank yoou Tim!

  • @andrijanamarkovic2990
    @andrijanamarkovic29902 жыл бұрын

    👏 THANK 👏 YOU 👏 TIM 👏

  • @olanrewajudimeji3560
    @olanrewajudimeji35602 жыл бұрын

    Hey Tim,I am always edified anytime I watch your video,I really wish you can make a video about cloud computing,I really need to know what path to follow to become a cloud engineer,I would be glad if you could kindly help me with that man.

  • @quyettranvan6506
    @quyettranvan65062 жыл бұрын

    Great video! Can you make more videos about data engineer?

  • @visothipong3387
    @visothipong33872 жыл бұрын

    Great 👍

  • @sarabasheer4352
    @sarabasheer435210 ай бұрын

    amazing

  • @ziyad7780
    @ziyad77802 жыл бұрын

    gonna watch this

  • @nite5963
    @nite59632 жыл бұрын

    33:25 Actully since nums2 (m) is always less than nums1 (n) or it will raise an error, we can replace m with n as it will always be less and thus we have a time complexity of O(n)

  • @amaarquadri
    @amaarquadri2 жыл бұрын

    Great video! I find it funny that the last example is O(n!) because it literally implements a factorial by repeatedly adding 1 😂. A normal implementation would be linear.

  • @64imma
    @64imma Жыл бұрын

    I'm watching your tutorials, and I'm thinking about what you said about the importance of developing good communication skills. I've watched plenty of coding tutorials that, yeah, all the information is there, but I fall asleep halfway through and barely learn anything. Your tutorials are different. You're so good at articulating what is going on, even if it's hard to explain. Do you have any resources you could recommend for improving communication skills? Even as a 28 year old, I feel like I'm very socially awkward, and struggle to clearly communicate what I am thinking.

  • @lolhappyfaceftw
    @lolhappyfaceftw2 жыл бұрын

    Great video, Tim! One thing that I was curious about was whether it matters what the base of the logarithm actually is. Since constant coefficients don't matter for Big O notation, and change-of-base rule can be used to turn any logarithm into a different base using a constant factor (i.e. log2(x) = logb(x)/logb(2)), does the distinction of saying log2 even matter for Big O? Perhaps I'm missing something here or it's just a convention to use log2?

  • @TechWithTim

    @TechWithTim

    2 жыл бұрын

    Great question! Usually u can get away with just using log, however if you want to be most accurate then you use the actual base. Like u said u can write it as a constant and remove the base by writing in the format u suggested and that’s still correct. So answer is it’s really up to you and if you’re in school your professor as to what is preferred.

  • @maxwealth.
    @maxwealth.2 жыл бұрын

    Would like to see more videos on algorithms like Depth-First Search or concepts like recursion…

  • @__________________________6910
    @__________________________69102 жыл бұрын

    36:00 tim bro I'm following

  • @aqifhebak1026
    @aqifhebak10262 жыл бұрын

    For logarithmic time complexity (43:33), say that n is being divided by 2 over and over again until it reaches 1 and we want to calculate how many times these divisions happen. You can think of it like this : n / 2 / 2 / 2 ... / 2 = 1 let's say that the division happened k times, that makes the equation like this: n / 2^k = 1 2^k = n k = log2(n) So the number of divisions is around log2(n).

  • @charlemagne7460

    @charlemagne7460

    2 жыл бұрын

    Nice explanation. Thank you

  • @aqifhebak1026

    @aqifhebak1026

    2 жыл бұрын

    Thanks :) you're welcome

  • @trevorelvis1355
    @trevorelvis13552 жыл бұрын

    I JUST CAN'T FIND THE WORDS TO EXPRESS MY GRATITUDE.

  • @suchakbarik-0812
    @suchakbarik-08122 жыл бұрын

    Please make series on DSA

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

    Now it makes a lot more of sense, thank you! The only thing I've noticed in example 9: why process = keys1 + keys2 is O(n + m)? we already counted keys1 and keys2, and as I see it, it shoul be O(1). Where am I wrong?

  • @santiagorodriguez2940
    @santiagorodriguez29402 жыл бұрын

    56:46 naively my thought would be that since you're only creating 1 subproblem of size n/4 each time, the cost of the operation is dominated by the cost of the root of the tree, which is in turn dominated by the cost of the operation in line 10. Therefore I'd say it's O((m+n) lg (m+n)) where m is equal to k + sum(k/4^i) with i ranging from 0 to log4(n) and k being the original length of results I'm assuming that's not the answer as it doesn't look as complicated as the triple-loop one

  • @amaarquadri

    @amaarquadri

    2 жыл бұрын

    I think this is correct. Only thing that I would add that m as you defined it is a constant multiple of n (since it's a convergent geometric series). So it simplifies to n*log(n).

  • @pravachanpatra4012
    @pravachanpatra40122 жыл бұрын

    Tim can you make Django projects, AI playing games, tutorial

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

    Hi tim, for example #4, can we write n^2 instead of hw?

  • @sahilbhor4694
    @sahilbhor46942 жыл бұрын

    Plz make DSA series.... Plz....

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

    33:59

  • @jimbb1832
    @jimbb18322 жыл бұрын

    What kind of psychopath writes their 1's from the bottom up? Love your videos, thanks for everything you've taught me!

  • @ojasver4772
    @ojasver47722 жыл бұрын

    Please start DSA playlist in python

  • @tcgvsocg1458
    @tcgvsocg14582 жыл бұрын

    can you show how to create "surprise me" bouton on webpage for exemple you see article on devellopement and you click surprise me and open 3 article webpage on developpeement but not the one you watch before

  • @mayman8415
    @mayman84152 жыл бұрын

    Yo man pls make a vid on burnout

  • @LeonaS-jd2wy
    @LeonaS-jd2wy2 жыл бұрын

    Hi guys, I have a quick question, and hope there's someone who knows the answer. Should I learn Python or Java if I want to do backend dev in North America in the future? Tim said that he is doing backend, and we know he uses Python. But there are also people who say since lots of big companies are using java, java is better for landing a job. Big thanks!

  • @SHYAMV-nx3jo
    @SHYAMV-nx3jo Жыл бұрын

    What does example 5 do? I am not able to understand what it does. Or is it just for representing time complexities?

  • @marychang6919
    @marychang69192 жыл бұрын

    constant, linear, exponential

  • @suharena188
    @suharena1882 ай бұрын

    I'm confused at 19:35 . Why didn't you set f(n)

  • @nite5963
    @nite59632 жыл бұрын

    45:05 won’t the function just never terminate since round(1/2) = 1 and we’re calling the same function

  • @SHYAMV-nx3jo

    @SHYAMV-nx3jo

    Жыл бұрын

    Rounding 0.5 actually gives 0 instead of 1, as 0 is not odd

  • @henrycook859
    @henrycook8592 жыл бұрын

    Looks like there's an error with example 7, did you mean to write "if n == 1: return"?

  • @scruffystudios8112
    @scruffystudios81122 жыл бұрын

    I'm somewhat confused on the simplification of ex8. n(k+klog2(k)) => n(klog2(k)) I don't see how that becomes simplified, could you go into a bit more detail please?

  • @santiagorodriguez2940

    @santiagorodriguez2940

    2 жыл бұрын

    O(k+k lg k) = O(max(k, k lg k)) = O(k lg k)

  • @GregDowns
    @GregDowns2 жыл бұрын

    Just a suggestion, in a video with this sort of content that not every viewer will be familiar with, it would be more rewarding to have the 'What is Big O notation?' section kick in at 00:00 instead of 1:12.

  • @GrandAmericaMotorcycleRides

    @GrandAmericaMotorcycleRides

    2 жыл бұрын

    That appears at 1:22 which is reasonable and in scope. I have found some video's from other instructors where instruction does not begin until after 4 minutes in lol

  • @jjophoven
    @jjophoven2 жыл бұрын

    I am going to make my own time complexity expect it is going to be called time simplicity.

  • @achintkaur51
    @achintkaur515 ай бұрын

    please provide the codes you are using in the video

  • @pixuhl
    @pixuhl2 жыл бұрын

    OH. Wrong big O. Good video.

  • @user-ob2sf2gy1e
    @user-ob2sf2gy1e11 ай бұрын

    AAOA-DJRs alorithims N Log N , O(2^N)-O(9^N) utilising AAOA-DJRs.

  • @nopens
    @nopens2 жыл бұрын

    Math was never my thing and i'm losing it at 18:53 already. Being a brainlet is hard.

  • @jamesssssss
    @jamesssssss2 жыл бұрын

    People are commenting on an hour-long video posted a few minutes ago as if they have already watched it...

  • @abd_cheese7353
    @abd_cheese73532 жыл бұрын

    I got the first two, completely failed the rest, then took one look at the final algorithm and said n!. W?????

  • @muditmehta07
    @muditmehta072 жыл бұрын

    Red

  • @Djn77645
    @Djn776452 жыл бұрын

    the day before my exam 🤧

  • @janakikenche8576
    @janakikenche85762 жыл бұрын

    Dude your voice matches with Andrew Garfield's voice

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

    Thank u so much ... may Allah guide u to accept Islam

  • @Frozen0wl
    @Frozen0wl2 жыл бұрын

    Can you please program a bot that plays the pong game @Tech With Tim

  • @aidanthompson5053
    @aidanthompson50539 ай бұрын

    51:24

  • @muditmehta07
    @muditmehta072 жыл бұрын

    Red