5 Steps to Crushing Big O

Understanding why Big O notation is important and how to calculate it

Image from: Bae S. (2019) Big-O Notation. In: JavaScript Data Structures and Algorithms. Apress, Berkeley, CA.

Why we use Big O

General concepts

Step #1: Count the steps

Example taken from Interview Cake’s Big O Notation and Space Complexity. Click here to view.
Graph showing the various types of algebraic runtimes in Big O. This is not all of the possible runtimes, just the most common.
Example of O(n²) runtime with nested loops

Step #2: Different steps get added

Example of a function where the variables are added for Big O

Step#3: Drop constants and coefficients

Step#4: Drop non-dominant terms

Pseudocode illustrating how dominant and non-dominant terms change as N gets larger

Step #5: Different inputs get different variables

Conclusion

Resources

Software Engineer, volleyball player, lover of tiny houses and all things spicy.

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