{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

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.
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

• Spring '08
• Myers
• Prime number, formal methods, following program segment, following English specifications, following proof outline

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern