This package defines an interface, {@link binarytree.BTree}, for binary trees and then it defines four implementations of that interface.

A binary tree has this algebraic data type.

{@code
   BTree  ::=  T  BTree  BTree
               |  Empty
   }
Each implementation of the {@link binarytree.BTree} interface implements the OR in this algebraic data type in a different way.

The {@link binarytree.LinkedBTree} implementation of {@link binarytree.BTree} defines a binary tree object as a reference to a {@code BTreeNode}, which is a private, nested class in {@link binarytree.LinkedBTree}. This reference to a {@code BTreeNode} is the "tag" that determines which case of the algebraic data type the object represents. If that reference is {@code null}, then that object represents an empty tree.

The {@link binarytree.BTreeLinked} implementation of {@link binarytree.BTree} is similar to {@link binarytree.LinkedBTree}. A {@link binarytree.BTreeLinked} object is defined as three references, a reference to the element of the binary tree node, a reference to the left branch tree, and a reference to the right branch tree. These three references combine to be the "tag" that determines which case of the algebraic data type an object represents. If all three references are {@code null}, then that object represents an empty tree.

The {@link binarytree.BTreeAbstract} implementation of {@link binarytree.BTree} is an abstract class with two concrete sub classes, {@link binarytree.BTreeNode} and {@link binarytree.EmptyBTree}. Since every object of type {@link binarytree.BTreeAbstract} "is a" {@link binarytree.BTreeNode} or "is a" {@link binarytree.EmptyBTree}, the two sub classes represent the two cases of the algebraic data type.

The fourth implementation of {@link binarytree.BTree} is {@link binarytree.FullBTree} and it actually implements this algebraic data type for a full binary tree.

{@code
   BTree  ::=  T  BTree  BTree
               |  T
   }
The implementation of {@link binarytree.FullBTree} is similar to {@link binarytree.BTreeLinked}. A {@link binarytree.FullBTree} object is defined as three references. These three references are used for both cases of the algebraic data type. The "tag" that tells us which kind of tree we have is the combination of the two child references. If both of them are {@code null}, then that object is a leaf node.