GATE | GATE-CS-2014-(Set-3) | Question 60

If G is a forest with n vertices and k connected components, how many edges does G have?
(A) floor(n/k)
(B) ceil(n/k)
(C) n-k
(D) n-k+1


Answer: (C)

Explanation: Each component will have n/k vertices (pigeonhole principle). Hence, for each component there will be (n/k)-1 edges.

Since there are k components, total number of edges= k*((n/k)-1) = n-k.


Quiz of this Question



My Personal Notes arrow_drop_up