100% Guaranteed Results


Exercises – Programming assignment 11 Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

Connected component

Input (Standard input)
In the first line, the number of vertices N (1 ≤ N ≤ 1,000) is given.
From the next line, the adjacency list of graph G is represented as the two integers x, y. This means the edge from vertex x to vertex y exists.

Output (Standard output)
In the first line, print the number of connected components.
In the next N lines, print the component number of each vertex.

[Example]
Input Output
6
1 2
1 4
2 5
3 6 2
1
1
2
1
1
2

Description
1. File name must be Connected_component.cpp
2. Make a comment of your student ID, name and class in the first line of the source code. ex) 2014601028_Honggildong_A
3. Please keep the source code that you have submitted for some unexpected accident.

Reviews

There are no reviews yet.

Be the first to review “Exercises – Programming assignment 11 Solved”

Your email address will not be published. Required fields are marked *

Related products