Question: Consider the find ( ) method and two possible specifications for it that we reviewed in class: int find ( int [ ] a ,

Consider the find() method and two possible specifications for it that we reviewed in class:
int find(int[] a, int value);
Specification 1:
requires: a is non-null and value occurs in a
modifies: none
effects: none
returns: i such that a[i]= value
Specification 2:
requires: a is non-null
modifies: none
effects: none
returns: i such that a[i]= value if value occurs in a and i =-1 if value is not in a
Part (a). Using just the formula P B -> P A QA -> QB (where A and B refer to two specifications) alone, which of the
two given specifications (Specification 1 or Specification 2) is stronger, if any? Give a clear answer and briefly justify it.
Part (b). If you apply a formula different from the one in part (a) or if you use the definition of comparing specifications
by strength, would your conclusion how Specification 1 strength compares to Specification 2 strength be different? Why
or why not?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!