# GATE | GATE CS 1997 | Question 42

Let G be the graph with 100 vertices numbered 1 to 100. Two vertices i and j are adjacent iff |i−j|=8 or |i−j|=12. The number of connected components in G is
(A) 8
(B) 4
(C) 12
(D) 25

Explanation: When vertices are arranged with difference of 8 there are 8 components as shown by 8 columns in the image below:

When vertices are arranged with difference of 12 the number of components is reduced to 4 as first column will be connected with fifth column, second column will be connected with sixth column, third column will be connected with seventh column and fourth column will be connected with eighth column. No other form of connection exists so total 4 connected components are there.

So, option (B) is correct.

This explanation is contributed by Pradeep Pandey.

Quiz of this Question

My Personal Notes arrow_drop_up

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.