package com.pandazilla.datastrutures.tree;

public class Tree {

    private Node root;

    public Tree() {
    }

    public void insert(int id, double data) {

    }

    public Node find(int key) {
        Node current = root;
        while(current.getData() != key) {
            if (key < current.getData()) {
                current = current.getLeftChild();
            } else {
                current = current.getRightChild();
            }
            if (current == null) {
                return null;
            }
        }
        return current;
    }

    public void delete(int id) {

    }
}

@@ -151,24 +151,847 @@
 ble data) %7B%0A
+        Node node = new Node();%0A        node.setKey(id);%0A        node.setData(data);%0A        if (root == null) %7B%0A            root = node;%0A        %7D else %7B%0A            Node current = root;%0A            Node parent;%0A            while(true) %7B%0A                parent = current;%0A                if (id %3C current.getKey()) %7B //move on left?%0A                    current = current.getLeftChild();%0A                    if (current == null) %7B%0A                        parent.setLeftChild(node);%0A                        return;%0A                    %7D%0A                %7D else %7B //move on right?%0A                    current = current.getRightChild();%0A                    if (current == null) %7B%0A                        parent.setRightChild(node);%0A                        return;%0A                    %7D%0A                %7D%0A            %7D%0A        %7D
 %0A    %7D%0A%0A    

insert operation in binary tree