Fall07Hw5

# Fall07Hw5 - k value Run it on the following directed...

This preview shows page 1. Sign up to view the full content.

CSE 5211 Fall 2007 Homework 5 Points: 30 Due: 10/23/07 1. The following is a recurrence formula. Write (a) a Recursive algorithm corresponding to the formula, (b) a Dynamic Programming algorithm, and (c) a Memoization algorithm, for computing a[i,j], where i and j are integers between 0 and a constant N>0. a[i, 0]= i, a[0, j]= j, a[i, j] = min{a[i-1,j]+1, a[i, j-1]+1, a[i-1, j-1] + 2} for both i and j >0. [10] 2. Programming assignment (4th): Points: 20 Implement the Floyd-Warshall All-pairs-shortest-path algorithm. It should print both D (distances) and Pi (intermediate nodes) matrices, for every iteration of
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: k value. Run it on the following directed weighted graph. (a, b, 3), (a, c, 8), (a, e, -4), (b, d, 1), (b, e, 7), (c, b, 4), (d, a, 2), (d, c, -5), (e, d, 6) Trace back the shortest path from the node a to the node d using the final Pi matrix (by hand). Run your program again on the graph: (a, b, 3), (a, c, 8), (a, e, -4), (b, d, 1), (b, e, 7), (c, b, 4), (d, a, 2), (d, c, -7), (e, d, 6) Can your program be modified to detect (1) that there exists a negative cycle, and (2) where is that negative cycle?...
View Full Document

## This note was uploaded on 02/10/2012 for the course CSE 5211 taught by Professor Dmitra during the Spring '12 term at FIT.

Ask a homework question - tutors are online