net.datastructures
Interface BinaryTree<E>

All Superinterfaces:
Tree<E>
All Known Subinterfaces:
CompleteBinaryTree<E>
All Known Implementing Classes:
ArrayListCompleteBinaryTree, AVLTree, BinarySearchTree, LinkedBinaryTree, RBTree

public interface BinaryTree<E>
extends Tree<E>

An interface for a binary tree, where each node can have zero, one, or two children.

Author:
Michael Goodrich

Method Summary
 boolean hasLeft(Position<E> v)
          Returns whether a node has a left child.
 boolean hasRight(Position<E> v)
          Returns whether a node has a right child.
 Position<E> left(Position<E> v)
          Returns the left child of a node.
 Position<E> right(Position<E> v)
          Returns the right child of a node.
 
Methods inherited from interface net.datastructures.Tree
children, isEmpty, isExternal, isInternal, isRoot, iterator, parent, positions, replace, root, size
 

Method Detail

left

Position<E> left(Position<E> v)
                 throws InvalidPositionException,
                        BoundaryViolationException
Returns the left child of a node.

Throws:
InvalidPositionException
BoundaryViolationException

right

Position<E> right(Position<E> v)
                  throws InvalidPositionException,
                         BoundaryViolationException
Returns the right child of a node.

Throws:
InvalidPositionException
BoundaryViolationException

hasLeft

boolean hasLeft(Position<E> v)
                throws InvalidPositionException
Returns whether a node has a left child.

Throws:
InvalidPositionException

hasRight

boolean hasRight(Position<E> v)
                 throws InvalidPositionException
Returns whether a node has a right child.

Throws:
InvalidPositionException