Question: Question 2: Bob the Builder Category: Easy-Medium [7] For developing the nation, Engineers decided to construct n roads to increase the communication between cities. There
![Question 2: Bob the Builder Category: Easy-Medium [7] For developing the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2f540004f1_52766f2f53f5f7e0.jpg)
Question 2: Bob the Builder Category: Easy-Medium [7] For developing the nation, Engineers decided to construct n roads to increase the communication between cities. There are m cities in that country. There is a cost associated with constructing new roads. The government wants to minimize the cost by not constructing all the roads rather constructing a few of these roads, but all cities need to be connected somehow. Now, You, the famous constructor, Bob the Builder, are given the n roads information that engineers planned to construct with the cost. You have to answer what is the maximum amount of money the government can save. In the first line of the input, you are given m and n. The following n lines represent the road information (city_x, city_y, cost). Print the maximum amount of money the government can save without any city being disconnected from other cities. Moreover, show the road the government should construct. 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
