subject

There are n buildings in campus. david doesn’t have a good memory, so he wants to choose n - 1 roads that, from any building in the campus, he can get to any building he wants. however, david doesn’t want to walk too much, so he also wants total length of all roads to be minimum. your task is to david to find those n - 1 roads. for the simplicity of the problem, instead of using building’s name, we will use the building’s number, so there are n buildings from 0 to n - 1. in map. java, implement the following method:
int mindistance(int[][] dists): takes an input of a 2-d integers array where dists[i][j]
is the distance of a single road from building i to building j (note that dists[i][i] is always 0
and dists[i][j] = dists[j][i] > 0 when i ! = j). returns the minimum total distance of n - 1
roads. for example, giving this 2-d array:
0 1 2 10
1 0 3 4
2 3 0 3
10 4 3 0
your method should return 6 because the roads david should choose are 0 - 1; 0 - 2; 2 - 3.
also include the main method in map. java to test at least 3 scenarios with n > 4

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:30
Agood flowchart alludes to both the inputs and outputs you will need to receive and give to the user. true or false?
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Which two technologies support the building of single-page applications?
Answers: 2
You know the right answer?
There are n buildings in campus. david doesn’t have a good memory, so he wants to choose n - 1 roads...
Questions
question
Mathematics, 21.02.2022 14:00
question
Mathematics, 21.02.2022 14:00
question
Mathematics, 21.02.2022 14:00
question
Computers and Technology, 21.02.2022 14:00
Questions on the website: 13722363