{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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.
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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern