// Class to store a single node of a binary tree public class TreeNode { public E data; public TreeNode left; public TreeNode right; // Constructs a node with the given data and left and right subtrees public TreeNode(E data, TreeNode left, TreeNode right) { this.data = data; this.left = left; this.right = right; } // Constructs a leaf node with the given data public TreeNode(E data) { this(data, null, null); } }