Question: Problem Statement : There are 2 * N nodes in an undirected graph, and a number of edges connecting some nodes. In each edge, the
Problem Statement :
There are N nodes in an undirected graph, and a number of edges connecting some nodes. In each edge, the first value will be between and N inclusive. The second node will be between N and N inclusive. Given a list of edges, determine the size of the smallest and largest connected components that have or more nodes. A node can have any number of connections. The highest node value will always be connected to at least other node.
Note Single nodes should not be considered in the answer.
Function Description
Complete the connectedComponents function in the editor below.
connectedComponents has the following parameters:
int bgn: a d array of integers that represent node ends of graph edges
Returns
int: an array with integers, the smallest and largest component sizes
Input Format
The first line contains an integer n the size of bg
Each of the next n lines contain two spaceseparated integers, bg i and bg i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
