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 02:00
6. the is particularly susceptible to the effects of alcohol because it receives a large portion of total blood flow and has a high concentration of neurons. a. heart b. pancreas c. brain d. liver
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
Read “suburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
Answers: 1
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, 28.05.2021 22:20
question
Chemistry, 28.05.2021 22:20
question
Chemistry, 28.05.2021 22:30
question
Mathematics, 28.05.2021 22:30