-2
$\begingroup$

ASSERT( P ) /* determine what is P */

A[i] = A[m];

A[k] = 2;

ASSERT( A[i] == x + 5 )

$\endgroup$

1 Answer 1

0
$\begingroup$

I don't know about the weakest but I can tell you about candidate precondition,a[m] is assigned to a[i] so the range of m must concide with that of i,the postcondition is a[i]==x+5 so a[m]==x+5.

I have used the fact that array is a collection of tuples of index and value and thus the above result.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.