Running Time: Standard Analysis

Even though this is a recursive routine, it's not convenient to analyze it using recurrences. Side effects!

n is number of nodes (pieces of clothing, construction activities)

m is the number of edges (constraints).

Each node is visited only once (we never make a node white), and for each node we loop over all its outgoing edges once. Therefore, we visit each edge once.

Total work: $\Theta(n+m)$.


next up previous
Next: Potential Function Analysis Up: TOPOLOGICAL SORT Previous: Correctness