Big O Notation
Given T(n) is the upper bound on a runtime of algorithm on the worst-case input of size n.
is if such that .

Example Problems
Takeaway: To solve problems comparing and some number to the power of convert the base number to using log rules and compare.
Alg. Analysis
Model of Computation:
- Basic arithmetic operations in O(1) time
- Infinite memory & O(1) time to access unit of memory
- All analysis in Big O
- Big O will be for a specific algorithm, NOT for the problem.
Max Substring Sum
Input: Array of integers Output: max sum from a substring of A, i.e, max where
Possible Solution 1, Brute Force Run time: times
max = 0
For i = 1 to n
For j = i to n
temp = 0
for k = i to j
temp = temp + a[k]
if temp > max then max = temp
return maxFaster Solution, Sliding WIndow Run time:
max = 0
For i = 1 to n
temp = 0
for j = i to n
temp = temp + a[j]
if temp > max then max = temp
return maxThere exists an solution using DP