# I need computer science help to make an algorithm

**Question description**

You live in City 0 and you want to go to City 1 then City 2 and so on until you reach City n, which is just another name for City 0. There are m different airlines that service those cities and you have created an n by n table A with airfare info. The entry A[i, j] corresponds to the airfare required to fly from City i-1 to City i on airline j. Unfortunately there are penalties for switching airlines. You create an n-1 by m by m table P containing penalty information. The entry P[i, j, k] corresponds to the penalty incurred when switching from airline j to airline k in City i. Fly as cheaply as possible .Devise an algorithm to solve this problem. It should output the total cost of the trip and display the airlines that you took to get to each city.

## Tutor Answer

## Review from our student for this Answer

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors