Skip to content

Instantly share code, notes, and snippets.

View eashann's full-sized avatar
👨‍💻

Ashraful Zaman Eashan eashann

👨‍💻
View GitHub Profile
@eashann
eashann / bigonotation.md
Last active August 9, 2022 12:47
Big O Notation

What is Big O Notation?

Big O is essentially an equation that describes how the runtime scales with respect to some input variables. At its most basic level, Big O Notation provides us with a quick way to assess the speed — or, more properly, the performance — of an algorithm. It measures how quickly the run-time grows relative to the input, as the input increases.

Understanding how fast your algorithms will run is a crucial skill in coding. For smaller data sets, this might not cause too many headaches, but the difference could be staggering on systems with a large number of users, data, and more.

*Before going into Big O Notation, I’ll explain why it’s crucial with a silly example. Let’s say you’ve got 10 emails, and one of those emails contains a phone number you need. You’re not allowed to use the search bar. How do you find the phone number? Well, it’s only 10 emails, so you probably just open each email one by one, scan over it, and open the next email. You keep going until you find the phone