net.datastructures
Interface CompleteBinaryTree<E>

All Superinterfaces:
BinaryTree<E>, Tree<E>
All Known Implementing Classes:
ArrayListCompleteBinaryTree

public interface CompleteBinaryTree<E>
extends BinaryTree<E>

An interface for a complete binary tree. A binary tree with height h is complete if the levels 0,1,2,...,h - 1 have the maximum number of nodes possible (that is, level i has 2i nodes, for 0 <= i <= h - 1) and in level h - 1 all the internal nodes are to the left of the external nodes.

Author:
Michael Goodrich

Method Summary
 Position<E> add(E elem)
          Adds an element to the tree just after the last node.
 E remove()
          Removes and returns the element stored in the last node of the tree.
 
Methods inherited from interface net.datastructures.BinaryTree
hasLeft, hasRight, left, right
 
Methods inherited from interface net.datastructures.Tree
children, isEmpty, isExternal, isInternal, isRoot, iterator, parent, positions, replace, root, size
 

Method Detail

add

Position<E> add(E elem)
Adds an element to the tree just after the last node. Returns the newly created position.


remove

E remove()
Removes and returns the element stored in the last node of the tree.