August 2024
Intermediate to advanced
516 pages
11h 47m
English
Big O achieves consistency by focusing on the number of steps an algorithm takes, but in a specific way. Let’s start off by applying Big O to the algorithm of linear search.
In a worst-case scenario, linear search will take as many steps as there are elements in the array. As we’ve previously phrased it: for N elements in the array, linear search can take up to N steps. The appropriate way to express this in Big O notation is:
O(N)
Some pronounce this as “Big Oh of N.” Others call it “Order of N.” My personal preference, however, is “Oh of N.”
Here’s what the notation means. It expresses the answer to what we’ll call the key question. The key question is this: if there are N data elements, how many ...
Read now
Unlock full access