- John Siwicki
In the past month, I had started and finished three different Frontend Masters courses. I wanted to do something more in-depth and I might follow up with my examples and samples. But, I wanted to publish some of my notes for my own reference and for document of the learning process as well.
Part 1: Data Structures & Algorithms
O = function n - represents number of elements
O(1) = static amount of time O(log n) - divide and conquer or binary search O(n) directly and linearly with N
O(NlogN) = merge search O(n2) = checking two lists O(infinity) - flipping a coin
Big O is the way we analyze how efficient algorithms (or code in this case) without getting too mired in the details.
O is just absorbing all the other fluff (including the factor on the biggest term.)
If we have no loops and just do something and exit/return, then it's said we're doing it in constant time, or O(1).
You can also have O(log n) if a code employs a divide-and-conquer strategy (often recursive,) meaning as you add more terms, the increases in time as you add input diminishes.
Recursion is when you define something in terms of itself. When we talk about recursion in computer science, we are talking about a function that calls itself.