Big O Notation
There are a number of harder puzzles in this book that make reference to the time or space complexity of a problem. An example requirement could read like “ensure your solution has a maximum time complexity of O(n)” - but what does this mean?
The Big O notation is often used in identifying how complex a problem is and defines the worst case complexity for a particular piece of code. The Big O notation is written as: O(...).
Examples
O(1), also known as constant, indicates that the given code will always take the exact same amount of time regardless of the input. A constant function could look like:
If the input_num = 0 or the input_num ...