subject
Computers and Technology, 01.12.2021 01:10 cld484

Write a function with declaration double pathLength(double** distance, int n, int* path, int m) where distance is a n by n 2d-array such that position distance[i][j] stores the road distance in miles from city i to city j; path is an integer array with m elements that stores a sequence of cities visited in a trip, i. e., 0 <= path[i] < n for all i such that 0 <= i < m n and m are greater than zero. The function should return the length in miles of the path. For example, for n = 5, distance the matrix below 0.0 30.0 10.0 70.0 10.0 30.0 0.0 45.0 100.0 50.0 10.0 45.0 0.0 85.0 20.0 70.0 100.0 85.0 0.0 100.0 10.0 50.0 20.0 100.0 0.0 and m = 3, path 0 1 2 pathLength(distance, n, path, m) returns 30 + 45 = 75. For same n and distance, but with m = 6 and path 0 1 0 3 2 0 pathLength(distance, n, path, m) returns 30 + 30 + 70 + 85 + 10 = 225.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 24.06.2019 03:30
Explain the importance of html in web page designing in 20 sentences..
Answers: 1
question
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
question
Computers and Technology, 24.06.2019 11:30
Why is body language an important factor in a business meeting
Answers: 1
You know the right answer?
Write a function with declaration double pathLength(double** distance, int n, int* path, int m) wher...
Questions
Questions on the website: 13722361