1What should you always think abt when developing an algorithm
Space complexity
Time complexity
2Time complexity?
Indicates how much time an algorithm takes to solve a problem
3Space complexity
Indicates how much memory the algorithm uses
4Big o notation?
Expresses complexity of algorithm and considers worst case scenario
- Remove all terms except one with largest factor/exponent
- Remove any constants
5Simplify this complexity: 5 +3n + 1
3n then n
6Worst case scenario
When we happen to choose the input which requires the most time
7Con_?
Constant complexity = O(1) = No matter how big/small the list/input size is, it takes the same amount of time
BEST

8Lin_?
Linear complexity = O(N) = As list/input size increases , time taken increases proportionally
Okay/mid

9Log_?
Logarithmic complexity = O(log N) = As input size/list increases, time taken increases at slower rates
Great

10Pol_?
Polynomial/quadratic =O(N$^{2}$) = As list/input size increases, time taken increases proportionally to the square of list/input size
Not great

11Ex_?
Exponential = O(2$^{N}$) =Each extra input added(from 2 to 3 etc),
DOUBLES time taken
WORST

12From best to worst sort the complexities out
BEST:
CONSTANT
LOGARITHMIC
LINEAR
POLYNOMIAL/QUADRATIC
EXPONENTIAL
WORST
13Calculate these functions complexity and then calculate its actual complexity

O(1) + O(n) + O(n^2) + O(1)
Becomes O(n^2)
14Bubble sort and insertion average and worst time complexity?
Polynomial = O(N$^2$) = for both
15Merge sort average and worst time complexity
Linearithmic = O(n log N)
16Quick sort average and worst time complixity
Average = Linearithmic
WORST = Polynomial = O(N$^2$)
17Image occlusion: name the hidden labels
18Linear search average and worst?
Linear = O(N) = for both
19Binary search array average and worst?
Logarithmic = O(log N) = for both
20Hashing average and worst?
Average = constant = O(1)
WORST = Linear = O(N) considers overflow list
21Image occlusion: name the hidden labels