An Intro to Time Complexity & Big-O Notation

A beginner’s guide to assessing and describing algorithm run time.

What the [insert expletive] is time complexity and big-O notation?

Sounds cool, but how do we evaluate how fast an algorithm runs?

Let’s add a print statement before the loop. How does that change the time complexity?

How does the time complexity change if we add a loop to print number 1 to n a second time?

What is the time complexity of the following summation algorithm?

How do we make it more time-efficient?

const variable = 100;
console.log("hello world")
for(i = 0; i < 3; i++) {
console.log(i)
}

The Little Extras

Full-stack developer. Funny-peculiar. Lover of baking, yoga, and reading (between the lines).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store