2. Key ingredients of greedy
algorithms
• Optimal substructure: An optimal solution to the
problem contains within it optimal solutions to
subproblems.
• Greedy-choice property: We can assemble a
globally optimal solution by making locally optimal
(greedy) choices.
13. Optimal substructure
MST T
Theorem. The subtree T1 is MST of G1 = (V1,E1),the subgragh
of G induced by the vertex of T1
Similarly for T2
T1
T2
G1
14. Proof of Optimal substructure
MST T
T1
T2
G1
w(T) = w(u, v) + w(T1) + w(T2)
If T1′ were a lower-weight spanning treat than T1
for G1, then T′ = {(u, v)} ∪ T1′ ∪ T2 would be a
lower-weight spanning tree than T of G
16. Theorem
Let T be the MST of G = (V,E), and let A ⊆ V.
Suppose that (u,v)∈ E is the least-weight edge
connecting A to V-A, then (u,v)∈ T
The proof is by contradiction(⽭矛盾)
Cut-and-Paste is a way used in proofing graph theory concepts, Idea: Assume you have
solution for Problem A, you want to say some edge/node, should be available in solution.
You will assume you have solution without specified edge/node, you try to reconstruct a
solution by cutting an edge/node and pasting specified edge/node and say new solution
benefit is at least as same as previous solution.