学习数据结构的第四天
class Solution { private class BST<E extends Comparable<E>> { //这里也是暗含乾坤,必须extends呀 private Node root; private int size; private class Node { E value; Node left; Node right; public Node(E e) { value=e; left=null; right=null; } } public boolean contains(E e) { return contains(this.root,e); } private boolean contains(Node node,E e) { if(node==null) return false; if(node.value.equals(e)) //如果是引用类型的话,那么就是.equals return true; if(node.value.compareTo(e)>0) return contains(node.left,e); if(node.value.compareTo(e)<0) return contains(node.right,e); return false; } public void add(E e) { this.size++;