Mid-Term 2 Flashcards
In general what are the two properties we need to prove that our greedy algorithm is optimal?
We need to prove the two following properties: 1) Greedy-choice property 2) Optimal substructure property
How do you prove the Greedy-choice property?
We are trying to prove that there exists an optimal solution for P that contains the greed choice made in the algorithm.
Proof of greedy-choice property: Assume that there is an optimal solution V that doesn’t make the same choice as our greedy choice. Prove that it makes a worse choice
How do you prove the optimal sub-structure property?
Optimal sub-structure property means that if we were to remove any choice we made from the solution, the resulting set is the optimal solution for this new subproblem.
In general, how is a knapsack problem defined?
Fractional Knapsack:
What is the input?
Fractional Knapsack:
What is the definition of a feasible solution?
Fractional Knapsack:
What is the required output?
Spell out the greedy choice made by densist-first algorithm for fractional knapsack.
What is the case 1?
Spell out the greedy choice made by densist-first algorithm for fractional knapsack.
What is the case 2?
Provide the proof for case 1: smax > k
Provide the proof for case 2: smax<= k
What is the goal of proving the optimal substructure property? What is the typical proof structure?
State case 1 of the master theorem.
What does it mean?
State case 2 of the master theorem.
What does it mean?
State case 3 of the master theorem.
What does it mean?