Carrie doesnt trust lazarus very much and wants to

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

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

Unformatted text preview: is unreachable from s). Carrie doesn’t trust Lazarus very much, and wants to write a “checker” routine that checks the output of Lazarus’s code (in some way that is more efficient than just recomputing the answer herself). Carrie writes a “checker” routine that checks the following conditions. (No need for her to check that w(u, v ) is always non-negative, since she creates this herself to pass to Lazarus.) (i) d[s] = 0 (ii) π [s] = N IL (iii) for all edges (u, v ) : d[v ] ≤ d[u] + w(u, v ) (iv) for all vertices v : if π [v ] = N IL, then d[v ] = d[π [v ]] + w(π [v ], v ) � (v) for all vertices v = s : if d[v ] < ∞, then π [v ] = N IL (equivalently: π [v ] = N IL =⇒ d[v ] = ∞) � � 1. Show, by means of an example, that Carrie’s conditions are not sufficient. That is, Lazarus’s code could output some...
View Full Document

Ask a homework question - tutors are online