/** * A binary search tree. * * @author Franck van Breugel */ public interface BinarySearchTree { /** * Returns the size of this binary search tree. * * @return the size of this binary search tree. */ int size(); /** * Tests whether this binary search tree contains the given element. * * @param element an element. * @return true if this binary search tree contains the given element, * false otherwise. */ boolean contains(int element); /** * Attempts to add the given element to this binary search tree. * The attempt is successful if this binary tree does not * contain the given element yet. Returns whether the attempt * is successful. * * @param element an element. * @return true if the attempt to add the given element is successful, * false otherwise. */ boolean add(int element); /** * Attempts to remove the given element from this binary search tree. * The attempt is successful if this binary tree contains the given * element. Returns whether the attempt is successful. * * @param element an element. * @return true if the attempt to remove the given element is successful, * false otherwise. */ boolean remove(int element); }