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 findint a int value;
Specification :
requires: a is nonnull and value occurs in a
modifies: none
effects: none
returns: i such that ai value
Specification :
requires: a is nonnull
modifies: none
effects: none
returns: i such that ai value if value occurs in a and i 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 or Specification 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 strength compares to Specification 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
