WTF Is Big O Notation?

WTF Is Big O Notation?

Rather than saying “need to loop over every item”, we can think about things in terms of operations again: if I use a Set or a List or a String I’ll need to have one operation for every n items in my cart. That’s a lot of words to describe this nested loop algorithm and we can do better if we use Big O.

Thinking in terms of operations, we have n operations per n items in our cart. In other words: a Sequential Scan is a loop over every item which means it’s O(n), where n represents the number of rows in our table.

Source: rob.conery.io