/** * Constructor creates tree from element as root and two subtrees * as left and right subtrees of root. * @param element element at root * @param leftSubtree left subtree * @param rightSubtree right subtree */ public LinkedBinaryTree (T element, LinkedBinaryTree leftSubtree, LinkedBinaryTree rightSubtree) { root = new BinaryTreeNode (element); count = 1; if (leftSubtree != null) { count = count + leftSubtree.size(); root.setLeft(leftSubtree.root); } else root.setLeft(null); if (rightSubtree !=null) { count = count + rightSubtree.size(); root.setRight(rightSubtree.root); } else root.setRight(null); }