Interface BinaryTree<E>

Type Parameters:
E - Element to be stored at each position of the tree.
All Superinterfaces:
Iterable<E>, Tree<E>
All Known Implementing Classes:
AbstractBinaryTree, LinkedBinaryTree, TreeMap.BalanceableBinaryTree

public interface BinaryTree<E> extends Tree<E>
An interface for a binary tree, in which each node has at most two children.
  • Method Details

    • left

      Returns the Position of p's left child (or null if no child exists).
      Parameters:
      p - A valid Position within the tree
      Returns:
      the Position of the left child (or null if no child exists)
      Throws:
      IllegalArgumentException - if p is not a valid Position for this tree
    • right

      Returns the Position of p's right child (or null if no child exists).
      Parameters:
      p - A valid Position within the tree
      Returns:
      the Position of the right child (or null if no child exists)
      Throws:
      IllegalArgumentException - if p is not a valid Position for this tree
    • sibling

      Returns the Position of p's sibling (or null if no sibling exists).
      Parameters:
      p - A valid Position within the tree
      Returns:
      the Position of the sibling (or null if no sibling exists)
      Throws:
      IllegalArgumentException - if p is not a valid Position for this tree