Graph Algorithms


Answer & solution
Answer: Choose u of degree at most one in the current induced forest; add u iff no original neighbor of u is already in I. (no official key was published)
Fill the first blank with: u is a leaf or isolated vertex in the forest induced by the current V. Fill the second with: u has no neighbor already in I, where adjacency is measured in the original tree. The removal changes the working forest only; it must not erase the adjacency information needed to test membership conflicts. Because every nonempty forest has a vertex of degree at most one, selection is always possible.
Independence is immediate: a vertex enters I only after checking that it is nonadjacent to every earlier selected vertex. To prove maximum size, maintain the stronger invariant that some maximum independent set of the original tree contains I and uses no previously rejected vertex. Consider a selected leaf u of the working forest. If u already has a neighbor in I, no independent set extending I can use u; rejecting it preserves the invariant. Otherwise u is eligible. In the remaining eligible graph it has at most one neighbor. If it has none, every maximum extension includes it. If it has one neighbor v, take a maximum extension: when it omits u, it must contain v (otherwise u could be added). Replace v by u. This preserves cardinality and independence, since u has no other eligible neighbor and none in I. Thus some maximum extension contains u, so adding u is safe.
At termination no undecided vertices remain; the invariant makes I itself maximum. “Choose any vertex and add it if possible” would guarantee only maximality, not maximum size: choosing the center of a star first is a counterexample. The leaf condition is essential.