Homework 9

CS 336 Fall 2003

Werth

 

Due Friday Nov 21, 2003

 

 

Problems to turn in

Section 9.5: 2,4,6,8, 12, 14, 32 (Use the proof of Prim's Algorithm suitably changed)

Section 3.6: 2,4,6

Problems on Weakest Pre-Condition

A.  Given the post-condition q:z=6 find the weakest precondition wp(S, q) for S the following block of code.  Show the steps along the way.

 

            x:=2

            z:=x+y

            if y > 0 then

                        z:= z+1

            else

                        z:=0

 

 

B.  Find the weakest pre-condition wp(S, q) where q: x=A AND y=B and S is the following code.  Show the steps along the way.  A and B are two constants.

 

            x:= x + y

            y:= x - y

            x:= x - y

 

 

 

 

 

Problems to study for pop quizzes

Section 9.5: 3, 6, 11, 13

Section:3.6: 1,3,5

The class notes