net.datastructures
Interface CompleteBinaryTree
- All Superinterfaces:
- BinaryTree, Tree
- All Known Implementing Classes:
- VectorCompleteBinaryTree
- public interface CompleteBinaryTree
- extends BinaryTree
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 |
add(Object elem)
Adds an element to the tree just after the last node. |
Object |
remove()
Removes and returns the element stored in the last node of the
tree. |
Methods inherited from interface net.datastructures.Tree |
children, elements, isEmpty, isExternal, isInternal, isRoot, parent, positions, replace, root, size |
add
public Position add(Object elem)
- Adds an element to the tree just after the last node. Returns
the newly created position.
remove
public Object remove()
- Removes and returns the element stored in the last node of the
tree.