datastructures

net.datastructures
Interface BinaryTree

All Superinterfaces:
Tree
All Known Subinterfaces:
CompleteBinaryTree
All Known Implementing Classes:
LinkedBinaryTree, VectorCompleteBinaryTree

public interface BinaryTree
extends Tree

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

Author:
Michael Goodrich

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

Method Detail

left

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

Throws:
InvalidPositionException
BoundaryViolationException

right

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

Throws:
InvalidPositionException
BoundaryViolationException

hasLeft

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

Throws:
InvalidPositionException

hasRight

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

Throws:
InvalidPositionException

datastructures