\subsubsection{\Containers}
\label{sec:container}
The fundamenal hierarchy of the \Link system is a hierarchy of
\Container\ classes. Class \Container\ itself is an abstract base 
class which defines the interface of all \Container\ subclasses.
In the \Link library, these include
\Array,\  \SortedArray,\ \BinaryHeap,\  \BinomialHeap,\ 
\BinarySearchTree,\  \DList,\  
\List,\  \Deque,\ \Stack,\ \Queue,\ 
\SortedList,\ and \RedBlackTree, though the programmer may 
define additional
container classes as long as the interface is respected.
This shallow hierarchy of containers is useful because certain 
common operations 
such as iteration, comparison, and display can be presented to the 
programmer with a common interface,
even though the underlying mechanisms may differ.  In fact, the \Iterator\ 
objects an operate seamlessly on
both \Containers\ and \Collections\ (see~\ref{sec:collection}).
There are two basic varieties of \Container.
The first variety is templated only by a key field, and currently 
contains \Array,\  \List,\  \DList,\  \SortedArray,\  and \SortedList.
The second variety, dictionaries,
are templated by key and information fields.  This set of classes currently
includes \BinaryHeap,\  \BinomialHeap,\  \BinarySearchTree,\  and \RedBlackTree.

It is straightforward to add new \Container\ objects to LINK. 
These must be templated 
with a single {\em Item} argument, which will be assumed to have the 
following operators defined:
\verb+==+, \verb+<=+, \verb+!=+, and \verb+<<+.  Furthermore, the {\em Item}
element type must be comparable and displayable.

\Containers\ and \Collections\ may be compared using the overloaded C++
operators: \verb+==+, \verb+!=+, \verb+<=+, \verb+<+, \verb+>=+, and
\verb+>+.  The comparison is based on 
lexicographic ordering of the elements.  In 
general, {\em if two objects of class Collection or Container contain the
same elements in the same order, then they are considered equal}.  
Inequalities are decided based upon the lexicographic ordering of the 
individual elements.  An example involving \List\ comparisons is given
in Figure~\ref{fig:List5}.
\begin{figure}[tbp]
\input{ProgList5.tex}
\caption{Defining, iterating through, and comparing \Containers}
\label{fig:List5}
\end{figure}
