exam3-002 - CSE 260-002 Exam 3-ANSWERS Spring 2011 Time 50...

This preview shows pages 1–3. Sign up to view the full content.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE 260-002: Exam 3-ANSWERS, Spring 2011 Time: 50 minutes Name: This exam has 4 pages and 10 problems totaling 100 points. This exam is closed book and closed notes. 1. Warshall’s algorithm for transitive closure computation is based on dynamic programming which uses the following recursive formula: ∀ i,j,k ≤ n w [ k ] ij = w [ k- 1] ij ∨ ( w [ k- 1] ik ∧ w [ k- 1] kj ) Based on the above recursive formula, Warshall’s algorithm is written as follows: W = M R ; M R is the 0-1 matrix for the relation R . For k=1 to n do the following: For i=1 to n do the following: For j=1 to n do the following: w ij = w ij ∨ ( w ik ∧ w kj ) Let W k be the zero-one matrix produced in the kth. iteration. (a) (5 points) What do the logical operations on the right hand side of the fol- lowing statement accomplish in computing the transitive closure? Explain your answer. w ij = w ij ∨ ( w ik ∧ w kj ) It computes the path ij by connecting paths ik and kj going throug k. (b) (3 points) Give W = M R for the relation { ( b, a ) , ( a, b ) , ( a, c ) } W = M R = a b c a 1 1 b 1 c (c) (6 points) Based on the ordering of the nodes as a, b, c give the matrices W 1 through W 3 as produced by the Warshall’s algorithm. W 1 = a b c a 1 1 b 1 1 1 c W 2 = a b c a 1 1 1 b 1 1 1 c 1 W 3 = a b c a 1 1 1 b 1 1 1 c (d) (3 points) Give the run time complexity of the Warshall’s algorithm. O ( n 3 ) 2. Following relation is defined on the set A = { 15 , 20 , 29 , 27 } R = { ( a, b ) ²A × A | a ≡ b (mod 3) } (a) (5 points) Give the relation R as a set....
View Full Document

This note was uploaded on 01/29/2012 for the course CSE 260 taught by Professor Saktipramanik during the Spring '08 term at Michigan State University.

Page1 / 6

exam3-002 - CSE 260-002 Exam 3-ANSWERS Spring 2011 Time 50...

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

View Full Document
Ask a homework question - tutors are online