基于二分搜索树实现集合

package structures;

public interface Set {
    void add(E e);
    void remove(E e);
    boolean isEmpty();
    int getSize();
    boolean contains(E e);
}
package structures;

public class BSTSet> implements Set {

    private BST bst;

    public BSTSet() {
        bst = new BST<>();
    }

    @Override
    public void add(E e) {
        bst.add(e);
    }

    @Override
    public void remove(E e) {
        bst.remove(e);
    }

    @Override
    public boolean isEmpty() {
        return bst.isEmpty();
    }

    @Override
    public int getSize() {
        return bst.getSize();
    }

    @Override
    public boolean contains(E e) {
        return bst.contains(e);
    }
}

你可能感兴趣的:(基于二分搜索树实现集合)