FINAL - short answer/equations Flashcards
Get an A+ on the final exam!!
Greedy choice property
The (a) greedy choice is contained in a globally optimal solution
Optimal substructure property
A globally optimal solution contains globally optimal solutions to its subproblems
Cardinality
The number of elements in a set
7 steps to solve a DP problem
- Define variables, 2. Express final numeric answer using variables, 3. Recurrence relation between the variables, 4. Dependency graph, 5. Figure out the order to solve the subproblems, 6. Pseudocode, 7. Reconstruct an actual optimal solution
What form does the recurrence have to take to use Master Theorem?
For Master Theorem, what is the level cost?
For Master Theorem, what is the # base cases?
For Master Theorem, what is the # levels?
For Master Theorem Case 1, what condition must be met?
Level cost is polynomially SMALLER than # base cases
What is the running time T(n) for Master Theorem Case 1 (level cost is poly SMALLER than # base cases)?
For Master Theorem Case 3, what condition must be met?
Level cost is polynomially LARGER than # base cases
For Master Theorem Case 3, what extra condition must be met?
What is the running time T(n) for Master Theorem Case 3 (Level cost is polynomially LARGER than # base cases)?
For Master Theorem Case 2, what condition must be met?
Level cost is in Big-Theta(# base cases)
For Master Theorem Case 2, what is the runtime T(n)?
What summation is this equation true for?
A BFS Tree is also…
The single source shortest path tree (where the weight of each edge is 1)
Tree edge (BFS)
An edge from a gray to a white node, where the white node is first being discovered (also called discovery edges)
BFS Applications
- Test if G is connected
- Compute a spanning tree of G
- Compute the connected components of G
- Compute the shortest path/distance between s and each vertex v in G