What is Big O Notation
shows how efficient an algorithm is in the worst-case scenario relative to its input size
Omicron
Time Complexity
How much time does it take to run completely?
Space Complexity
How much extra space does it require in the process?
Ω
Omega
Best case scenario
Loop through [1, 2, 3, 4, 5, 6, 7] looking for 1
θ
Theta
Average case
Loop through [1, 2, 3, 4, 5, 6, 7] looking for 4
O
Omicron
Worst case
Loop through [1, 2, 3, 4, 5, 6, 7] looking for 7
Contiguous vs Noncontigous
Types of memory allocation
Stack
Data Structure
Queue
Data Structure
Binary Tree
Data Structure
Binary Search Tree
for any node:
* any nodes below and right will be greater than
* any nodes below and left will be less than
Big O of for loop
O(n)
Linear Time
Big O of arr.push() or arr.pop()
O(1)
Constant time
Big O of sorting algorithm
usually O(nlog n)
For JS array sort, depends on (browser) implementation