Final Review CMPS 6610, Fall 2018
The Final exam is Monday, December 10th, 9am-noon in the regular classroom (GI 325)
Relevant Material:
- All material from 8/27/18 until 12/5/18 (inclusive).
- This includes material covered in the lectures and homeworks 1 - 10.
Topics from Test 1
- Analyzing Algorithms (Ch. 2.2)
- Best case and worst case runtimes
- Asymptotic Notation (Ch. 3, A)
- О, Ω, Θ, ο
- Prove by definition (find a value for c>0 and n_0 > 0
so that for all n≥n_0 the inequality is satisfied)
- f(n) ∈ O(g(n))
- f(n) ∈ Ω(g(n))
- f(n) ∈ Θ(g(n)) [prove both O and Ω]
- Know how to use the limit theorem.
- Analyze code snippets.
- Know summations: Arithmetic series, geometric series (finite and infinite), Harmonic number.
- Practice problems from the book:
- page 22: 2.1-2, 2.1-3
- page 39: 2.3-3,4,5,6,7
- page 39: 2-1,4
- Heaps (Ch. 6)
- Heap definition; max-heap property
- Using array implementation, findMin takes O(1) time, and extractMin and decreaseKey take O(log n) time
- Heapsort: Repeatedly extract min in min-heap; O(n log n) time
- Practice problems from the book:
- page 153: all exercises
- page 156: 6.2-3, 6.2-4
- page 160: 6.4-3
- page 167: 6-2
- Divide & Conquer (Ch. 2.3, 4.3, 4.4, 4.5, 4.6)
- You can call an algorithm divide-and-conquer only if the size of
subproblems can be written as n/b where b>1
- Mergesort, binary search, recursive squaring
- Not: Convex hull
- Find the runtime recurrence for a recursive algorithm given in pseudocode
- Solving Recurrences: Solve a runtime recurrence (i.e., find an upper bound for a recursively defined T(n)):
- Recursion Tree: Find a guess what a (runtime) recurrence could solve to
using recursion trees
- Given T(n) = aT(n/b) + f(n)
- a = #of subproblems = #of children at each node
- n/b = subproblem size
- Height of the tree = log_b (n) [log of n base b]
- Big-Oh Induction
- Prove your guess/claim using big-Oh induction (substitution method): Find conditions on constants c and n_0 in inductive step. (No need to handle base case.)
- Master Theorem
- Compute n^(log_b (a)) and compare with f(n)
- Clearly write which case of the Master theorem applies, and give the values for ε, k, and c:
- For case 1: Give the value of ε>0
- For case 2: Give the value of k≥0
- For case 3: Give the value of ε>0, check the regularity condition and give the value of c<1
- Proof of the master theorem
- Practice problems from the book:
- page 87: all exercises
- page 92: all exercises
- page 96: 4.5-1,2,3
- page 107: 4-1,3
- Quicksort (Ch. 5.2, C.3, 7)
- Randomized Algorithms
- Probability and expectation
- Expected runtime vs. average runtime, best-case runtime, and worst-case runtime
- Quicksort
- Deterministic quicksort:
- Best-case runtime O(n log n) [When each pivot partitions the array into two roughly equal pieces]
- Worst-case runtime: O(n^2) [When the array is already sorted either increasing or decreasing order]
- Randomized quicksort: Expected runtime O(n log n)
- Practice problems from the book:
- page 1200: C.3-1,2,3,4
- page 122: 5.2-3,4,5
- page 143: 5-2
- page 173: all exercises
- page 178: 7.2-1,2,3
Topics from Test 2
See
Test 2 Review
Other Topics
- Network Flow (Ch. 26.1-26.3)
- Definitions of flow network, flow, cuts
- Definitions of residual network, augmenting path. Edges
with zero residual capacity do not exist in the residual network
(alternatively, an augmenting path over them would have capacity zero).
- Max-flow min-cut theorem
- Ford-Fulkerson:
- Chooses an arbitrary graph in the residual network to augment
- Runtime: O(|E| |f*|)
- Edmonds-Karp:
- Chooses a shortest augmenting path in the residual network. The length of the path is measured by the number of edges.
- Runtime: O(|V| |E|^2)
- Maximum bipartite matching
- Practice problems from the book:
- page 712: 26.1-1,6
- page 730: 26.2-2,3,4,10,11
- More Randomized Algorithms (Extra material on slides/pictures page)
- Global Min-Cut
- Las Vegas vs. Monte Carlo algorithms
- High-probability bound for Quicksort (turn Las Vegas algorithm into Monte Carlo)
- Practice problems:
- P and NP (Ch. 34, 35.1, 35.2
- Definition of P, NP, NP-hard, NP-complete, Co-NP
- Reductions
- NP-complete problems (SAT, Clique, TSP, Hamiltonian Cycle, Vertex Cover, Independent Set)
- Approximation algorithms (Vertex Cover, TSP)
- Practice problems from the book:
- page 1060: 34.1-1
- page 1065: 34.2-1,2,3,6,7,8,9,10
- page 1100: 34.5-1,5,6,7
- page 1111: 35.1-1,2,4
- page 1122: 35.3-2