Question
DATA STRUCTURES IN C/ TREES Please only use c language. (at the end of the question there will be an example of the problem for
DATA STRUCTURES IN C/ TREES
Please only use c language. (at the end of the question there will be an example of the problem for more details)
the question is:
If You want to travel, then you choose to travel by plane to another country, and there may be layovers along the way. Each edge comes with its corresponding ticket price. calculate the following:
1) calculate the minimum cost from the starting point to the destination.
2. Determine the number of paths that yield the minimum cost (since the answer may be too large, modulo 10^9 + 7)
3. Calculate the minimum number of flights to take while minimizing the cost 4. Calculate the maximum number of flights to take while minimizing the cost
The program needs to read its inputs let say input.txt in a text file and put the output in another textfile output.txt
for our input we have the following rules
and as output: produce one line of output for each input. and print four integers according to the problem statement
here is an input sample and output sample
input(reading it from the text file):
1
4 5
1 4 5
1 2 4
2 4 5
1 3 2
3 4 3
output(to a text file):
5 2 1 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started