Midterm3sol - COT 5405 Analysis of Algorithms, Spring 2010....

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COT 5405 Analysis of Algorithms, Spring 2010. Midterm 3 April 8, 2010 Name: UFID: Notes This is a closed-book exam. No calculator. You have 100 minutes for the exam. If the problem necessitates writing an algorithm, you must first informally describe the algorithm, in brief, in a paragraph. You can choose to follow this up with pseudocode that formally describes the algorithm. We will peruse your pseudocode only if your English description is not clear. Write your name on the top right hand corner of your exam. Be sure to write your last name as the last word in your name. If you are designing an algorithm, you must write a formal proof of correctness. Please write legibly. 1 1. [1 page][33points] The following graph with weights on edges is given. Apply Floyd-Warshall algo- rithm to compute shortest path between all pairs of vertices (only the distance of the path, not the path itself). Provide a weight matrix at each iteration. Floyd-Warshall recurrence relation is as below. Let D ( k ) = ( d ( k ) i,j ) be the weight matrix after k th iteration, d ( k ) i,j = min ( d ( k- 1) i,j ,d ( k- 1) i,k + d ( k- 1) k,j ) , k 1 d (0) i,j = if i = j weight of edge ( i,j ) if i 6 = j otherwise 1 3 5 4 2 3 1 1-2 5-1 3 Solution: D = 2 1 3 0 3- 2 2 4 1 0- 1- 1 9 6 5 4 12 9 8 3 2 2. [1 page][33points] You need to go over a river by canoe and there are n trading posts along the river....
View Full Document

This note was uploaded on 01/15/2012 for the course COT 5405 taught by Professor Ungor during the Fall '08 term at University of Florida.

Page1 / 4

Midterm3sol - COT 5405 Analysis of Algorithms, Spring 2010....

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online