Computer Science, asked by Dsravan, 11 months ago

Program to calculate fare if source and destination are given

Answers

Answered by sunitdeviakale
0

Explanation:

Input:

cost[N][N] = { {0, 15, 80, 90},

{INF, 0, 40, 50},

{INF, INF, 0, 70},

{INF, INF, INF, 0}

};

There are 4 stations and cost[i][j] indicates cost to reach j

from i. The entries where j < i are meaningless.

Output:

The minimum cost is 65

The minimum cost can be obtained by first going to station 1

from 0. Then from station 1 to station 3.

Similar questions