@@ -0,0 +1,2122 @@
+package ru.agolovin;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0A/**%0A * @author agolovin (agolovin@list.ru)%0A * @version $Id$%0A * @since 0.1%0A */%0Apublic class BinaryTree%3CE extends Comparable%3CE%3E%3E implements Iterable%3CE%3E %7B%0A%0A    /**%0A     * index add nodes.%0A     */%0A    private int nodesIndex;%0A%0A    /**%0A     * Nodes array.%0A     */%0A    private List%3CNode%3CE%3E%3E nodes;%0A%0A    /**%0A     * main node.%0A     */%0A    private Node%3CE%3E mainNode;%0A%0A    /**%0A     * Constructor.%0A     */%0A    BinaryTree() %7B%0A        nodes = new ArrayList%3C%3E();%0A    %7D%0A%0A    public boolean add(E e) %7B%0A        boolean result = false;%0A        if (this.mainNode == null) %7B%0A            this.mainNode = new Node%3C%3E(e);%0A        %7D else %7B%0A            Node%3CE%3E children = mainNode;%0A            while (!result) %7B%0A                if (e.compareTo(children.value) %3E 0) %7B%0A                    if (children.right == null) %7B%0A                        children.right = new Node%3C%3E(e);%0A                        result = true;%0A                    %7D else %7B%0A                        children = children.right;%0A                    %7D%0A                %7D else %7B%0A                    if (children.left == null) %7B%0A                        children.left = new Node%3C%3E(e);%0A                        result = true;%0A                    %7D else %7B%0A                        children = children.left;%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    @Override%0A    public Iterator%3CE%3E iterator() %7B%0A        return new Iterator%3CE%3E() %7B%0A            @Override%0A            public boolean hasNext() %7B%0A                return false;%0A            %7D%0A%0A            @Override%0A            public E next() %7B%0A                return null;%0A            %7D%0A        %7D;%0A    %7D%0A%0A    class Node%3CE%3E %7B%0A%0A        /**%0A         * Left.%0A         */%0A        Node%3CE%3E left;%0A%0A        /**%0A         * Right.%0A         */%0A        Node%3CE%3E right;%0A%0A        /**%0A         * Inner value.%0A         */%0A        private E value;%0A%0A        /**%0A         * Constructor.%0A         *%0A         * @param value Generic%0A         */%0A        Node(E value) %7B%0A            this.value = value;%0A        %7D%0A    %7D%0A%7D%0A

add task3 in part6 chapter5 package2