A Beginner’s Guide to Big O Notation (Part 2)
An introduction to time complexity with help from Ratatouille
Well hey there, Chef Remy! Welcome back to the kitchen!
Today we’re going to complete our intro to Big O Notation with O(log n), O(n log n), O(2^n) and O(n!) via an impeccable film, Pixar’s Ratatouille. When we last left off, we were preparing our famous ratatouille dish for notorious restaurant critic Anton Ego who was waiting patiently for his meal.
As a refresher, check out the time complexity comparison chart below:
O(log n) Log Time
Let’s say our waiter received an order from a mysteriously cloaked man (Chef Skinner in disguise! 🕵🏻♂️) who said “I’ll have what he’s having” in reference to Anton Ego.
We know that Anton Ego is seated at table 29, so we will need to look up his food order through his table number. Lucky for us, the table numbers are always kept sorted in our array of orders
…