What is big O notation

This year I decided to take my programming to a new level. And I’ll be blogging about what I’m learning.

Currently I’m learning about algorithms.

I’ve seen this term Big O Notation thrown around a lot. And the first time I heard it explained was at a JS.LA meetup a couple years ago.

So here is my attempt at explaining what is Big O Notation.

Basically Big O Notation is a measurement of how well an algorithm performs given a certain amount of inputs. Or in other words how fast and/ or efficient is an algorithm.

There are equations that represent the many different kinds of algorithms.

The two biggest O equations to remember are O(1) and O(n).

An O(1) function is constant in how long it will take, no matter how many inputs (n) it has.

So if it has 1 or 1 million inputs and always completes in 1 second that means it is an O(1) function.

An O(n) function is linear in how long it will take. So the time it takes to run grows as you add more inputs.

A third function that you wouldn’t really want is one that is exponential O(N2) . That would mean that it would take exponentially longer as you add more inputs.

You can learn more about algorithms from here and I hope this little blog helped!

Sources (https://medium.com/basecs/whats-a-linked-list-anyway-part-2-131d96f71996 , https://www.topcoder.com/blog/big-o-notation-primer/ )