Introduction To Big O Notation And Time Complexity In 5 Minutes

The Test Lead
4 min readJun 14, 2024

Have you ever wondered how computer experts measure how fast algorithms are? That’s where Big O notation and time complexity come in. They’re like special tools that help us figure out how well algorithms work when we give them bigger problems. Let’s take five minutes to understand them better.

What is Big O Notation?

Big O notation is a fancy math way of saying how much time or memory an algorithm needs based on how big the problem is. In simpler words, it tells us if an algorithm gets slower or needs more memory as the problem gets bigger.

Understanding Time Complexity

Time complexity is like a clock that shows us how long an algorithm takes to solve a problem depending on how big the problem is. It helps us see how an algorithm’s speed changes when we give it bigger problems.

Common Time Complexities and Their Meanings:

We will go through each from fastest to slowest.

O(1) — Constant Time: Algorithms with constant time complexity execute in the same amount of time regardless of the input size. This is like an algorithm that’s always lightning fast no matter how big the problem is.

--

--

The Test Lead

SDET at fintech company in NYC. Visit personal page http://thetestinglead.com// Twitter @juss_bailey Youtube @The Test Lead