π -> 9/26/24: Course Intro
π€ Vocab
Algorithm:
- A well defined computational problem
- Well defined: You know exactly what the input is, and exactly what the output should be
- Well defined procedure that transforms the input into the output
β Unit and Larger Context
Knowledge base:
- Inductive Proof
- Basic Code Analysis
- Definition of Big-O, Limit Lemma
- Studied different algorithms, like sorting
- Data Structures
- Graph Algorithms
- DFS, BFS, MST, Shortest Path Dijkstraβs, β¦
Part 1: Analysis
- Growth Functions
- Growth functions for recursive equations / algorithms
Part 2: Algorithms by Solution Choice
- Divide and Conquer Algorithms
- Greedy Algorithms
- Dynamic Programming
Part 3: Graph Algorithms
- BFS, DFS, MST, Shortest Path: (Bellmans, Dijkstraβs, All Pairs Shortest Path)
Part 4:
Defining P/NP, NP-Hard, NP-Complete problems
NP stands for non-deterministically polynomial
- All poly problems can be solved with 1 thread in poly time
- NP is not non-polynomial
Topics
- Asymptotic Analysis (Non-recursive Functions; BIG-O, limit lemma)
- Asymptotic Analysis (Recurrences - substitution)
- Asymptotic Analysis (Recurrence Tree)
- Asymptotic Analysis (Master Theorem)
- Divide & Conquer Algorithm Design
- Greedy Algorithms
- Dynamic Programming
- Dynamic Programming is using caching / memoizing of functions to speed up algo
- Suboptimality and Greedy Proof
- Graphs (BFS, DFS, Bellman)
- Dijkstra Algorithm
- Prims Algorithm
- Kruskals Algorithm
- All Pairs Shortest Path
- P/NP
βοΈ -> Scratch Notes
Basic code analysis now
Ex1)
for (i=1; i<20; i++) {
print("hi")
}Code above is O(1), will not scale with N
T(n) = running in input size N
T(n) = O(1), T(n) = 40 = O(1)
Ex2)
for (i=1; i < n; i++) {
print("hi")
}T(n) = 2n = O(n)
Ex3)
while(i <= n) {
i = i + 2
print("hi")
}T(n) = n/2 = O(n)
Ex4)
while (i<=n) {
i = i * 2
print("hi")
}
O(log(n))
With nested while loops, you multiply computational cost
for (i to n) {
for (j to n) {
print("hi")
}
}O(n^2)
Review Done
ECS 122A Growth Function
Map ints of size n, to a permutation of the set S such that:
and - Sorting problem
Assessing an algorithm:
- Does it halt?
- Is it correct? (will it always produce the correct output)
- How much memory is used? (Space complexity)
- Is it fast?
- How does data communicate
Let T(n) be the runtime of the algorithm given the input of n
T(n) is O(f(n)) if
Prove that something is big O by finding that there exists
and such that the above is satisfied. Upon showing there existence, you have shown it is at least that big(O)
For:
π§ͺ-> Example
- List examples of where entry contents can fit in a larger context
π -> Related Word
- Link all related words