1.Maximum number of edges to be removed to contain exactly K connected components in the Graph
Spoj Question

Solution : (Using DFS)
Algo:
* Check the no of times DFS is called.
* If the Count of DFS is more than k return -1 as removal of edges will give rise to more connected components.
* Else return m-n+k.
Time Complexity: O(V+E)
Last updated
Was this helpful?