Node
Each piece of a structure that connects to others. In a linked list, a tree or a graph, each element is a node; in a distributed system, each computer.
Example
In a linked list, the node stores its value, for example 7, and where the next one is. A database cluster with 3 nodes is 3 machines.
Lessons that use it
Clusters
Many machines, one system
What is an algorithm
You already use algorithms
Space complexity
How much memory it asks for
Types of structures
How they relate and where they live
Arrays
Adjacent cells
Linked lists
Links of a chain
Dynamic lists
An array that grows by itself
Memory and cache
Close is fast
Stacks
Last in, first out
Queues
First in, first out
Deques
In and out at both ends
Hash collisions
When 2 keys want the same spot
Binary trees
Each node, at most 2 children
Walking a tree
By levels or by branches
Trees in an array
No references, just math
Binary search trees
Smaller on the left, larger on the right
AVL trees
A tree that straightens itself
Heaps
The smallest, always on top
Building a heap
Bottom-up is cheaper
Graphs
Points and connections
Walking a graph
BFS and DFS, now with cycles
Binary search in depth
2 pointers closing in
Choosing how to search
Brute force or using the order
Merge sort
Split in half and merge in order
Heap sort
Take the maximum and leave it at the end
Divide and conquer
Split, solve and combine
Rebuilding a tree
Root, left and right
Tower of Hanoi
n − 1, 1 and n − 1
Backtracking
Try, and if it fails, go back
Solving with DP
State, transition and borders
Greedy algorithms
The best right now
NoSQL databases
Beyond tables
CAP theorem
Pick 2 of 3
Distributed transactions
Everyone commits or nobody does
Consistent hashing
A ring to split the load
Quadtrees
Splitting the map in 4
Rate limiting
A cap on requests
Service discovery
Where is that service?
Designing Twitter
1 billion tweets a day
Designing Uber
10 million rides a day
