Consider the following four specifications to insert an element val into a list l i st. For
Question:
Consider the following four specifications to insert an element val into a list l i st. For e ach pair of specifications, state whether one is substitutable for the other. Defend your answer.
(a) require: val is not in list ensure: list contains all of its previous values plus val
(
b) ensure: if val is already in l i st, then list is unchanged; otherwise l ist contains all of its previous values plus v a l
(c ) ensure: 1 is t contains all of its previous values plus val
(d) require: list is sorted ensure: l i st contains all of its previous values plus val , and l ist is sorted
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: