Homework 2 Optional Problems
Consider a connected undirected graph
with edge costs, which need not be distinct. Prove the following statement or provide a counterexample: for every MST of , there exists a way to sort ’s edges in nondecreasing order of cost so that Kruskal’s algorithm outputs the tree .
ANSWER: Given a MST
Consider a connected undirected graph
with distinct edge costs that are positive integers between and , where is the number of vertices of . How fast can you compute the MST of ?
ANSWER: We may use Radix Sort instead of a comparison sort to sort in linear time. We don’t use Counting Sort 1 because it’s going to take
Read about matroids. Prove that the greedy algorithm correctly computes a maximum-weight basis. For the matroid of spanning trees of a graph, this algorithm becomes Kruskal’s algorithm. Can you formulate an analog of Prim’s MST algorithm for matroids?
ANSWER: CLRS section 16.4 has an excellent introduction to Matroids. Also see the Metroid section in the curated list. Quoting CLRS:
A graphic matroid
defined in terms of a given undirected graph as follows:
- The set
is defined to be , the set of edges of . - If
is a subset of , then iff is acyclic. That is, a set of edges is independent if and only if the subgraph forms a forest.
If we define the weight function such that weight
Prim’s algorithm, on the other hand, maintains an induced subgraph
Prove that our analysis of union-find with lazy unions and union by rank (but without path compression) is asymptotically optimal (i.e., there are sequences of operations where you do
work on most of the operations).
ANSWER: The upper bound is proven is lecture video 7.3. For the lower bound, consider doing a find operation on the leaf node in a path of length
Prove that in our union-find data structure with lazy unions, union by rank, and path compression, some operations might require
time.
ANSWER: See Tarjan’s paper in the curated list.
Leave a comment