HW2F08 - 3 Establish the correctness or incorrectness of...

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

View Full Document Right Arrow Icon
CS336 HW2F08 Due January 31 1. Find the weakest precondition for the following: a. wp(“j,s:=0,0”, s=( Σ k| 0 k<j:b[k])) b. wp(“j,s:=j+1, s+b[j]”, s=( Σ k| 0 k<j:b[k])) 2. Formalize the following English specifications a. Set z to |x|. b. Determine if an integer >1 is prime. c. Find the position of the maximum value in an array. d. Find the position of the first maximum value in an array.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3. Establish the correctness or incorrectness of the following program segment. The commands of the following proof outline could be used to find the smallest value in an array. {( ∀ j| 0 ≤ j ≤ i-1 : x ≤ b[j])} if x ≤ b[i] → skip & x ≥ b[i] → x:= b[i] fi; i:= i+ 1 {( ∀ j| 0 ≤ j ≤ i-1 : x ≤ b[j])}...
View Full Document

This note was uploaded on 03/19/2008 for the course CS 336 taught by Professor Myers during the Spring '08 term at University of Texas.

Ask a homework question - tutors are online