A Month Of JS

Jun 3, 2018 · 234 words · 2 minute read javascript data structures

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.

The Frontend Masters courses that I took where https://frontendmasters.com/courses/data-structures-algorithms/ , https://frontendmasters.com/courses/javascript-hard-parts/

Part 1: Data Structures & Algorithms

Big O

O(n)

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

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.