tree
Interface BinaryTree

All Superinterfaces:
Tree
All Known Subinterfaces:
CompleteBinaryTree

public interface BinaryTree
extends Tree

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


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

Method Detail

left

public container.Position left(container.Position v)
                        throws InvalidPositionException,
                               BoundaryViolationException
Returns the left child of a node.

InvalidPositionException
BoundaryViolationException

right

public container.Position right(container.Position v)
                         throws InvalidPositionException,
                                BoundaryViolationException
Returns the right child of a node.

InvalidPositionException
BoundaryViolationException

hasLeft

public boolean hasLeft(container.Position v)
                throws InvalidPositionException
Returns whether a node has a left child.

InvalidPositionException

hasRight

public boolean hasRight(container.Position v)
                 throws InvalidPositionException
Returns whether a node has a right child.

InvalidPositionException