
\usepackage{noweb}
\setlength{\codemargin}{\parindent}
\def\nwendcode{\endtrivlist \endgroup } %\filbreak
\nwcodepenalty=0  %\@highpenalty
\let\nwdocspar=\par%\filbreak 

\def\nwendcode{\endtrivlist \endgroup }
\nwcodepenalty=0 
\let\nwdocspar=\par%\filbreak 

%the following settings are adequate for European size a4 paper
\textwidth 16cm  
\textheight 24 cm  
\topmargin -14mm    
\evensidemargin 3mm 
\oddsidemargin 3mm
%the following settings are adequate for US legal size paper
%\textwidth 16cm  
%\textheight 24 cm  
%\topmargin -14mm    
%\evensidemargin 3mm 
%\oddsidemargin 3mm
\sloppy 

\newenvironment{manual}{
\baselineskip 3.0ex     % was 14pt about 1/5in = 0.5cm
%\spaceskip  .4em plus .25em minus .25em
%\xspaceskip .65em
\parskip 11pt plus 1pt minus 1pt
\parindent 0pt
}% the manual style
{}% There is nothing to do when I leave the environment

\def\Lless{\hbox{\tt <}}
\def\Lgreater{\hbox{\tt >}}
\def\<{\hbox{\tt <}}
\def\>{\hbox{\tt >}}
\def\underscore{_}
\def\Lle{\le}
\def\Lge{\ge}
\def\Dplus{{++}}
\def\Dminus{{--}}
\newcommand{\Lass}[1]{\mathrel{{#1}{=}}}
\newcommand{\Lminuseq}{{-}{=}}
\def\Noteq{{!}{=}}
\def\Leq{\equiv}
\def\Larrow{\rightarrow}
\def\tildeop{{\sim}}
\def\Tildeop{{\char126}}
\def\circumflexop{\hbox{\^{}}}
\newcommand{\DP}{\hspace{.1em}{::}\hspace{-.2em}} % symbol for ::
\newcommand{\nspacedot}{\hspace{-0.09em}}
\newcommand{\nspaceunderscore}{\hspace{-0.13em}}
\newcommand{\Lrquote}{\mbox{'}}
\newcommand{\Llquote}{\mbox{`}}
\newcommand{\KLL}{@$\<\<$}
\newcommand{\KGG}{@$\>\>$}
\newcommand{\DLK}{{\tt [[}}
\newcommand{\DRK}{{\tt ]]}}
\newcommand{\Ln}{\mbox{$\backslash${\tt n}}}


\def\CC{C\raise.08ex\hbox{\tt ++\ }}
\def\CCC{C\raise.08ex\hbox{\tt ++}}
\def\g++{g\hbox{\tt ++\ }} 
\def\nat{\hbox{\rm\vrule\kern-0.045em N}}
\def\real{\hbox{\rm\vrule\kern-0.035em R}}

\def\precond {{\it Precondition}: }
\def\Labs#1{\hbox{$|\,#1\,|$}}
\def\Lvert{|}
%\def\Litem#1{\hbox{{\tt <}$#1${\tt >}\ }}
\def\Litem#1{\hbox{$\langle #1 \rangle$}}
%I am not using the following anymore.
\def\sign{\mathop{\rm sign}}
\def\3{\ss{}}
\def\boxit#1{\vbox{\hrule\hbox{\vrule\kern3pt\vbox{#1}\kern3pt\vrule}\hrule}}
\def\co{\hbox{\tt //\ }}
\def\'{\hbox{\tt "}}
\def\'{^\prime}
\def\+{$+$}
\def\refsign{\hbox{\tt \&}}


\newcommand{\headerline}[1]
    {\smallskip\pagebreak[2]\par
     \parbox[t]{\textwidth}{{\bf #1}}\par
     \nopagebreak

    }%empty line is crucial 

\def\definition       {\headerline{1. Definition}}
\def\creation         {\headerline{2. Creation}}
\def\operations       {\headerline{3. Operations}}
\def\implementation   {\headerline{4. Implementation}}
\def\example          {\headerline{5. Example}}




\newlength{\rowsep} \setlength{\rowsep}{0.7ex} %separation in two-row layout

\newlength{\entrysep} \setlength{\entrysep}{0.5ex} %additional pace between entries

\newlength{\colsep} \settowidth{\colsep}{\ }    

\newlength{\typewidth} \setlength{\typewidth}{0.15\textwidth}    

\newlength{\callwidth} \setlength{\callwidth}{.25\textwidth}      

\newlength{\declwidth} \setlength{\declwidth}{0.25\textwidth}  

\newlength{\longcallwidth}
\newlength{\descriptwidth}
\newlength{\createtextwidth}
\newlength{\textminusdescriptwidth}
\newlength{\typepluscallwidth}

\newcommand{\computewidths}  
        {
          \setlength{\createtextwidth}{\textwidth}
          \addtolength{\createtextwidth}{-\declwidth}             

          \setlength{\longcallwidth}{\textwidth} 
          \addtolength{\longcallwidth}{-\typewidth}

         \setlength{\descriptwidth}{\textwidth}
         \addtolength{\descriptwidth}{-\typewidth}
         \addtolength{\descriptwidth}{-\callwidth} 

         \setlength{\textminusdescriptwidth}{\textwidth}
         \addtolength{\textminusdescriptwidth}{-\descriptwidth}

         \setlength{\typepluscallwidth}{\typewidth}
         \addtolength{\typepluscallwidth}{\callwidth}
       }

\def\setopdims #1 #2   {\typewidth=#1cm
                        \callwidth=#2cm
                        \computewidths
                        }


\computewidths    % initializes all widths

\usepackage{ifthen}
\newlength{\actualcallwidth}
\newlength{\actualtypewidth}
\newlength{\actualtypepluscallwidth}
\newlength{\fnamewidth}
\newlength{\checkwidth}

\newcommand{\function}[4] 
   {\setlength{\checkwidth}{\typewidth}   
   \addtolength{\checkwidth}{\callwidth}
   \addtolength{\checkwidth}{\descriptwidth}
   \ifthenelse{\lengthtest{\checkwidth = \textwidth}}
              {}
              {\typein{WARNING: The invariant 
\typewidth + \callwidth + \descriptwidth = \textwidth is violated. 
Did you change one of the quantities without calling
\protect\computewidths? I do it for you. If the output looks okay
and you changed textwidth after reading in Lweb.sty it is safe to ignore
this warning. Type any character to proceed.}
\computewidths}

       \settowidth{\actualcallwidth}{#2(#3)}        
       \settowidth{\actualtypewidth}{#1}
       \addtolength{\actualcallwidth}{\colsep}
       \addtolength{\actualtypewidth}{\colsep} 
       \ifthenelse{\actualtypewidth > \typewidth}
       {%\typeout{WARNING: #1 is too long to fit into the box provided for the return type.}
        %\typein{\\Type anything to acknowledge.} 
        \settowidth{\actualtypepluscallwidth}{#1\ #2(#3)}
        \addtolength{\actualtypepluscallwidth}{\colsep}
        \ifthenelse{\actualtypepluscallwidth > \typepluscallwidth}
        {% begin then1
       \settowidth{\fnamewidth}{#1\ #2(}%
       \setlength{\parlistwidth}{\textwidth}%
       \addtolength{\parlistwidth}{-\fnamewidth}%
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\fnamewidth}{#1\ #2(}%
       \parbox[t]{\parlistwidth}{\raggedright \sloppy #3)}\vspace{\rowsep}\\%
       \hspace*{\typewidth}\hfill\parbox[t]{\descriptwidth}{\sloppy #4}%
       }%end big parbox       
       }%end then1
       {%else descript on same line
       \parbox[t]{\typepluscallwidth}{#1\ #2(#3)}%  
       \parbox[t]{\descriptwidth}{\sloppy #4}%
       }% end else descript on same line 
       }% end return type does not fit
       {% else return type fits                      
       \ifthenelse{\actualcallwidth > \callwidth}
      {\settowidth{\fnamewidth}{#2(}%
       \setlength{\parlistwidth}{\longcallwidth}%
       \addtolength{\parlistwidth}{-\fnamewidth}%
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\typewidth}{#1}\parbox[t]{\fnamewidth}{#2(}%
       \parbox[t]{\parlistwidth}{\raggedright \sloppy #3)}\vspace{\rowsep}\\%
       \hspace*{\typewidth}\hfill\parbox[t]{\descriptwidth}{\sloppy #4}%
       }%end big parbox       
      }%end then
      {
       \noindent\parbox[t]{\typewidth}{\fussy #1}%
       \parbox[t]{\callwidth}{\raggedright \sloppy  #2(#3)}%\hspace{\colsep} 
       \parbox[t]{\descriptwidth}{\sloppy #4}%
      }%end else
      }%end retrun type fits
       \vspace{\entrysep}
       \par
       }

\newcommand{\operator}[3] 
      {%\smallskip
       \settowidth{\actualcallwidth}{#2} 
       \settowidth{\actualtypewidth}{#1}
       \addtolength{\actualcallwidth}{\colsep}
       \addtolength{\actualtypewidth}{\colsep} 
       \ifthenelse{\actualtypewidth > \typewidth}
       {%\typeout{WARNING: #1 is too long to fit into the box provided
%for the return type. I adopt another layout style. }
        %\typein{\\Type anything to acknowledge.}
        \settowidth{\actualtypepluscallwidth}{#1\ #2}
        \addtolength{\actualtypepluscallwidth}{\colsep}
        \ifthenelse{\actualtypepluscallwidth > \typepluscallwidth}
        {\parbox[t]{\textwidth}{%
       \parbox[t]{\textwidth}{#1\ #2}\vspace{\rowsep}\\%
       \hspace*{\textminusdescriptwidth}\parbox[t]{\descriptwidth}{\sloppy #3}%
       } %end big parbox
       }
       {%else descript on same line
       \parbox[t]{\typepluscallwidth}{#1\ #2}  
       \parbox[t]{\descriptwidth}{\sloppy #3}%
       }
       }
       {%else return type fits                     
       \ifthenelse{\actualcallwidth > \callwidth}
      {
       \noindent
       \parbox[t]{\textwidth}{%
       \parbox[t]{\typewidth}{\fussy #1}\parbox[t]{\longcallwidth}{\raggedright \sloppy #2}\vspace{\rowsep}\\%
       \hspace*{\textminusdescriptwidth}\parbox[t]{\descriptwidth}{\sloppy #3}%
       } %end big parbox
      }%end then
      {
       \noindent\parbox[t]{\typewidth}{\fussy #1}%\hspace{\colsep}
       \parbox[t]{\callwidth}{\raggedright \sloppy  #2}%\hspace{\colsep}%  
       \parbox[t]{\descriptwidth}{\sloppy #3}%
      }%end else
      }%end outermost else
       \vspace{\entrysep}
       \par
       }



\usepackage{ifthen}
\newlength{\actualdeclwidth} \newlength{\parlistwidth}
\newcommand{\decl}{}
\newlength{\actualtypeplusnamewidth}

\newcommand{\create}[4] 
  {\setlength{\checkwidth}{\declwidth}   
   \addtolength{\checkwidth}{\createtextwidth}
   \ifthenelse{\lengthtest{\checkwidth = \textwidth}}
              {}
              {\typein{WARNING: The invariant \declwidth + \createtextwidth = \textwidth is violated. Did you change one of the quantities without calling
\protect\computewidths? I do it for you. If the output looks okay and you
changed textwidth after reading Lweb.sty it is safe to ignore this warning. Type any character to proceed.}
\computewidths}
   \ifthenelse{\equal{#3}{}}%
              {\renewcommand{\decl}{#1\ \ #2;}}%
              {\renewcommand{\decl}{#1\ \ #2(#3);}}%\typeout{decl is \decl}
   \settowidth{\actualdeclwidth}{\decl}
   \addtolength{\actualdeclwidth}{\colsep}
   \ifthenelse {\actualdeclwidth > \declwidth}
         {%\typeout{decl is long}
          \ifthenelse{\actualdeclwidth > \textwidth}
             {%\typeout{decl is very long}
              \settowidth{\actualtypeplusnamewidth}{#1\ \ #2(}%
               \setlength{\parlistwidth}{\textwidth}%
               \addtolength{\parlistwidth}{-\actualtypeplusnamewidth}%
               \parbox[t]{\textwidth}{%
               \parbox[t]{\actualtypeplusnamewidth}{#1\ \ #2(}%
                \parbox[t]{\parlistwidth}{\raggedright #3);}%
                \vspace{\rowsep}\\%
               \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #4}% 
                                      }%end parbox
             }
             {%\typeout{decl is long}
              \parbox[t]{\textwidth}{%
               \parbox[t]{\textwidth}{\decl}\vspace{\rowsep}\\%
               \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #4}% 
                                      }%end parbox
             }
       }%end then
       {%\typeout{decl is short}
\parbox[t]{\declwidth}{\decl}\parbox[t]{\createtextwidth}{\sloppy #4}%
       }%end else
  \vspace{\entrysep}\par
    }


\usepackage{ifthen}
\newlength{\actualdestructwidth}

\newcommand{\destruct}[2]
      { \settowidth{\actualdestructwidth}{$\sim$#1()}
        \ifthenelse {\actualdestructwidth > \declwidth}
           { \noindent
             \parbox[t]{\textwidth}{%
                 \parbox[t]{\textwidth}{$\sim$#1()}\vspace{\rowsep}\\%
                 \hspace*{1cm}\hfill\parbox[t]{\createtextwidth}{\sloppy #2}%
              } 
           }
           {\noindent\parbox[t]{\declwidth}{$\sim$#1()}%
            \parbox[t]{\createtextwidth}{\sloppy #2}%
           }
         \vspace{\entrysep}\par 
       }



\def\Mdefinition       {{\bf $\backslash$ Mdefinition}\\}
\def\Mcreation         {{\bf $\backslash$ Mcreation}\\}
\def\Moperations       {{\bf $\backslash$ Moperations}\\}
\def\Mimplementation   {{\bf $\backslash$ Mimplementation}\\}
\def\Mexample          {{\bf $\backslash$ Mexample}\\}
\def\Mcreate           {{\bf $\backslash$ Mcreate}\\}

\def\Mop               {{\bf $\backslash$ Mop}        \hspace{1cm}}
\def\Mopl              {{\bf $\backslash$ Mopl}       \hspace{1cm}}
\def\Mbinop            {{\bf $\backslash$ Mbinop}     \hspace{1cm}}
\def\Marrop            {{\bf $\backslash$ Marrop}     \hspace{1cm}}
\def\Mfunop            {{\bf $\backslash$ Mfunop}     \hspace{1cm}}
\def\Munop             {{\bf $\backslash$ Munop}      \hspace{1cm}}
\def\Mfunc             {{\bf $\backslash$ Mfunc}      \hspace{1cm}}
\def\Mfuncl            {{\bf $\backslash$ Mfunc}      \hspace{1cm}}
\def\Mbinopfunc        {{\bf $\backslash$ Mbinopfunc} \hspace{1cm}}
\def\Munopfunc         {{\bf $\backslash$ Munopfunc}  \hspace{1cm}}




\def\If       {{\bf if} }
\def\Fi       {{\bf fi} }
\def\Then     {{\bf then} }
\def\Else     {{\bf else} }
\def\Do       {{\bf do} }
\def\Od       {{\bf od} }
\def\For      {{\bf for} }
\def\While    {{\bf while} }
\def\Return   {{\bf return} }
\def\Break    {{\bf return} }
\def\Continue {{\bf continue} }
\def\Case     {{\bf case} }
\def\Switch   {{\bf switch} }
\def\Class    {{\bf class} }
\def\Struct   {{\bf struct} }
\def\Public   {{\bf public} }
\def\Friend   {{\bf friend} }
\def\Typedef  {{\bf typedef} }

\def\n {\backslash n}



% LEDA macros:

\def\Forall         {{\bf forall} }
\def\Forallnodes    {{\bf forall\_nodes} }
\def\Foralledges    {{\bf forall\_edges} }
\def\Foralladjnodes {{\bf forall\_adj\_nodes} }
\def\Foralladjedges {{\bf forall\_adj\_edges} }


% verbatim

\font\ttbig= cmtt10 scaled \magstephalf

\chardef\other=12
\def\ttverbatim {
\parskip 5pt
\catcode`\&=\other \catcode`\{=\other \catcode`\}=\other
%\catcode'\\=\other 
\catcode`\$=\other \catcode`\&=\other
\catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
\catcode`\_=\other \catcode`\^=\other
\obeyspaces \obeylines}


% usage:
%
%\begingroup
% \ttbig
% {\obeyspaces\gdef {\ }}
% \ttverbatim
%
% ...
%
%\endgroup



\newcommand{\noeffect}{}

\newenvironment{Lcode}{%
\addtolength{\topsep}{-2.5ex}%
\@begincode  
}
{\endtrivlist
\vspace{0.5ex}  % Leerzeile ist wichtig??

}

\newlength{\Lemptyline}
\setlength{\Lemptyline}{1ex}
\newcount\Lhighpen \Lhighpen=10000
\newcount\Llowpen \Llowpen=-30




