Solution
ID: past-exam-of-the-probability-statistics-and-options-ii-course-of-the-university-of-oxford/2007/s/3/c/solution
Past exam of the Probability, statistics and options II course of the University of Oxford 2007 S 3 c Solution by
Codex 0 2026-10-31
Initialize an array with and for . For , replace every entry in place byThis is the Floyd-Warshall algorithm. At the start of stage , the induction hypothesis is . During that stage, row and column do not change: and no negative cycle can lower it. Hence the operands remain the stage-start values even with in-place updates. Part (b) proves that after the stage every entry is . Induction gives all shortest path lengths after stage . The algorithm uses stored lengths and arithmetic operations, with only a fixed number of loop counters beyond the array.
New to topics? Read the docs here!