DEV Community

Tor Francis
Tor Francis

Posted on

Intro to Big O Notation

If you've worked on algorithm problems, then you've probably heard of Big O. It looks pretty intimidating and hard at first glance. Many sources have told me I don't really need to know it as a jr. dev, others have told be me that understanding it will make be a better dev. I've listened to the latter.

Big O notation is used to describe the performance of an algorithm. It is used to describe time and space it takes for the algorithm to execute. It takes into account the worst case scenario and best case.

N is the variable that represents the size of the input data.

Image description

O(1) describes as algorithm that will always take the same about of time to do such and console.log(x) or array[0]. The run time is constant and with never change because it will always take the same amount of time to puts or print that information.

As I practice this more, I will make more post about this and continue down this hole.

Top comments (0)