Question 6:
=================================================================
Consider the design by contract approach
in the context of binary search trees.
You write the contract for a method which
has as precondition the property that the
tree must be a binary search tree.
You use a check predicate that is implemented
using the following Check function object.
The check predicate expresses
that the integers in the left subtree
must all be smaller than the integer at the root
and the integers in the right subtree must all be
greater than or equal to the integer at the root.
PART 1
======
Your check method must work for cd-pure.
Find the UNKNOWN below.
class Check extends IDb {
boolean combine(BSTInt l){ return true; }
UNKNOWN
}
PART 2
======
Can you make your check predicate work for both
cd-pure and cd-with-noise by changing it?
PART 3
======
Discuss whether you have any Law of Demeter violations
in your program. Justify your answer.