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

CS Dojo · 2.2M views · 2018 · 36:22

Open on YouTube

Algorithms & data structuresEducation & learningtutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about loop runtimes, algorithm efficiency and time-limit errors, as an accessible primer on time complexity.

Recommended by 4 people across 3 different months, 2018 to 2020.

What it is

CS Dojo's beginner-friendly explainer on Big O notation and time complexity, part 7 of a data structures and algorithms series. It walks through how to reason about how runtime scales with input size, with worked examples of loops and common complexity classes.

What people said

Recommends Raqib · 2018-10 · Stack Overflow · on “What is the runtime of this nested for loop?”

Each for loop is O(n), two for loops O(n)*O(n) = O(n^2) Check this link [this video] out. The author explains good ways to approach figuring out runtimes.

Recommends martin · 2020-03 · Stack Overflow · on “Python loop performance”

Yes, it is the same thing because of something called "Time Complexity". This is how much the time scales with the given input. It's hard to explain in just a post like this, but it means that you're looping through 100 elements no matter what and it won't change the duration. I recommend this video where it is explained perfectly: [this video]

Recommends Akshath Mahajan · 2020-03 · Stack Overflow · on “how to measure efficient algorithm”

Your best bet would be to theoretically calculate the Big O notation for all your algorithms. You should check out what Big O [LINK] is here if you don't know Or you could check out this video [this video]

Recommends Imnotapotato · 2020-07 · Stack Overflow · on “My sorting algorithm says :Your code did not execute within the time limits. how to solve this problem”

i came across your post with a similar question regarding time complexity, and I have found this video very helpful: [this video]