@@ -0,0 +1,2255 @@
+ /**%0A *%0A * @author Dante%0A */%0Apublic class BinarySearchTree %7B%0A%0A    public static Node root;%0A    %0A    //Constructor%0A    public BinarySearchTree() %7B%0A        this.root = null;%0A    %7D%0A    %0A    /*%0A    Complexity: O(n) because it visit every node once%0A    */%0A    public boolean treeSearch(int id) %7B%0A        %0A        //Parte sempre dalla radice%0A        Node current = root;%0A        while (current != null) %7B   //procede finch%C3%A8 ci sono nodi%0A            if (current.key == id) %7B  //se %C3%A8 uguale all'id univoco ha finito%0A                return true;%0A            %7D else if (current.key %3E id) %7B  //se %C3%A8 maggiore dell'id va a dx%0A                current = current.left;%0A            %7D else %7B%0A                current = current.right;  //altrimenti a sx%0A            %7D%0A        %7D%0A        return false;  //se non ritorna true ha fallito la ricerca%0A    %7D%0A %0A    %0A    // This method mainly calls insertRec()%0A    void insert(int key) %7B%0A       root = insertUtil(root, key);%0A    %7D%0A    %0A    /*Function to insert the node in a specific case%0A    Since it's not static the root will not be changed%0A    */%0A    Node insertUtil(Node root, int value) %7B%0A        %0A        //when it gets to a leaf.%0A        if (root == null) %7B%0A            root = new Node(value);%0A            return root;%0A        %7D%0A        %0A        //go to the left%0A        if (value %3C root.key)   root.left = insertUtil(root.left, value);%0A        //go to the right%0A        else if (value %3E root.key) root.right = insertUtil(root.right, value);%0A %0A        return root;%0A    %7D%0A%0A    public void displayInOrder(Node root) %7B%0A        if (root != null) %7B%0A            displayInOrder(root.left);%0A            System.out.print(%22 %22 + root.key);%0A            displayInOrder(root.right);%0A        %7D%0A    %7D%0A     %0A%0A    public static void main(String arg%5B%5D) %7B%0A        BinarySearchTree b = new BinarySearchTree();%0A        int value = 5;%0A        b.insert(1);%0A        b.insert(2);%0A        b.insert(3);%0A        b.insert(4);%0A        b.insert(5);%0A        b.insert(6);%0A        b.insert(7);%0A        b.insert(8);%0A        b.insert(9);%0A        b.insert(11);%0A        b.insert(15);%0A        b.insert(16);%0A        System.out.println(%22Tree : %22);%0A        b.displayInOrder(b.root);  %0A        System.out.println(%221nSearch %22+value+%22: %22 + b.treeSearch(value));  %0A    %7D%0A%7D%0A

Create BinarySearchTree.java