\typeout{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
\typeout{algav.sty: powered by upmc.sty}
\typeout{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{upmc}}
\ProcessOptions
\RequirePackage{../common_files/upmc}
\ProvidesPackage{algav}[2006/10/06]

%les sections
\def\TD{\begin{center} {\hrulefill \huge\textbf{ TD } \hrulefill} \end{center}
  \setcounter{exo-int}{0}}
\def\TME{\begin{center} {\hrulefill \huge\textbf{ TME }} \hrulefill \end{center}
  \setcounter{exo-int}{0}}

% Pseudo-code
\lstdefinelanguage{pseudocode}{%
  keywords={tantque,TantQue,faire,Faire,fintantque,si,Si,alors,Alors,sinon,Sinon,finsi,fin,Fin,retourne,var,pour,Pour,Chaque},%
  basicstyle=\footnotesize\ttfamily,%
  keywordstyle=\bfseries,%
  showstringspaces=false,%
  comment=[l]{//},%
  extendedchars}[keywords]

\lstset{basicstyle=\ttfamily}

\def\e{\mbox{ \ \ }}
\def\Sn{\mbox{${\cal S}_n$}}
\def\EQL{\begin{eqnarray*}}
\def\ENL{\end{eqnarray*}}
\def\Card{{\rm Card}\,}
\def\et{\mbox{ \ \ et \ \ }}
\def\pere{\texttt{pere}\,}
\def\fils{\texttt{fils}\,}
\def\pred{\texttt{pred}\,}
\def\succ{\texttt{succ}\,}
\def\degre{\texttt{degre}\,}
\def\clef{\texttt{clef}\,}
\def\taille{\texttt{taille}\,}
\def\marque{\texttt{marque}\,}

\def\cardinal#1{{\ensuremath{\left|{#1}\right|}}}
\def\min{\ensuremath{\mathrm{min}}}

\def\C {\ensuremath{\mathbb{C}}}
\def\Q {\ensuremath{\mathbb{Q}}}
\def\N {\ensuremath{\mathbb{N}}}
\def\R {\ensuremath{\mathbb{R}}}
\def\Z {\ensuremath{\mathbb{Z}}}
\def\F {\ensuremath{\mathbb{F}}}
\def\H {\ensuremath{\mathbb{H}}}
\def\Q {\ensuremath{\mathbb{Q}}}
\def\A {\ensuremath{\mathbb{A}}}
\def\vect#1{\mbox{$\stackrel{\longrightarrow}{#1}$}}
\hyphenation{pa-ra-me-tri-za-tion}
\def\eqdf{\buildrel{\rm def}\over =}
\newtheorem{theorem}{Theorem} [section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{proposition}{Proposition} [section]
\newtheorem{example}{Example}[section]
\newtheorem{notation}{Notation}[section]
\newtheorem{convention}{Convention}[section]
\def\cqfd{\mbox{}\nolinebreak\hfill\rule{2mm}{2mm}\medbreak\par}

\def\leq{\leqslant}
\def\geq{\geqslant}

\def\diplome{Master STL}
\def\module{CPA}

\usepackage{tikz}
\usetikzlibrary{trees,arrows}

\tikzstyle{heapnode}=[circle, fill=white, draw=black,
                    thick, inner sep=0pt, minimum size=6mm]
\tikzstyle{marked}=[fill=green!20]
\tikzstyle{minarrow}=[->, >=latex]

\newcommand{\vide}{child {edge from parent [draw=none]}}
\newcommand{\threenode}[2]{\begin{tabular}{|c|c|}\hline {#1}&{#2}\\\hline\end{tabular}}
\newcommand{\fournode}[3]{\begin{tabular}{|c|c|c|}\hline {#1}&{#2}&{#3}\\\hline\end{tabular}}
\newcommand{\bucketone}[2]{node (#1) [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm] 
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip] 
      {\begin{tabular}{c}#2\\\end{tabular}}}}}
\newcommand{\buckettwo}[3]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm] 
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip] 
      {\begin{tabular}{c} #2\\#3\\\end{tabular}}}}}
\newcommand{\bucketthree}[4]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm] 
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip] 
      {\begin{tabular}{c}#2\\#3\\#4\\\end{tabular}}}}}
\newcommand{\bucketfour}[5]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm] 
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip] 
      {\begin{tabular}{c}#2\\#3\\#4\\#5\\\end{tabular}}}}}
\newcommand{\bucketfive}[6]{node (#1)  [draw,thick,grow=down] {$\bullet$}
  {child {edge from parent [draw,thick,->,shorten >=1cm] 
      node [anchor=north,draw,thick,outer ysep=-0.5\baselineskip] 
      {\begin{tabular}{c}#2\\#3\\#4\\#5\\#6\\\end{tabular}}}}}


\newsavebox{\upsolutionBox}

%\makeatletter
\newenvironment{upsolution}%
  {\if@printanswers\uplevel\bgroup\fi\begin{solution}}%
  {\end{solution}\if@printanswers\egroup\fi}
\renewenvironment{TheSolution}[1][\solutiontitle]%
  {%
    \vspace{\parskip}%
    % If we don't set \leftskip and \rightskip to 0pt, then if we
    % appear inside of an \uplevel command we'd have indentation
    % inside of the solution box:
    \leftskip=0pt
    \rightskip=0pt\setlength{\parindent}{18pt}
    \if@framedsolutions
      % Do nothing; we'll use the default \FrameCommand
    \else
      \def\FrameCommand{\colorbox{SolutionColor}}%
    \fi
    \MakeFramed{\advance\hsize-\width}%
    #1%instead of: \solutiontitle
    \ignorespaces
  }%
  {%
    \unskip
    \endMakeFramed
  }%
\newcommand{\remarktitle}{\noindent\textbf{Remarque:}\enspace}
\newenvironment{remark}[1][0pt]%
  {%
    \if@printanswers
      \begin{TheSolution}[\remarktitle]%
    \else
      \par
      \vspace*{#1}%
      \setbox\z@\vbox\bgroup
    \fi
  }{%
    \if@printanswers
      \end{TheSolution}%
    \else
      \egroup
    \fi
  }%
\newcommand{\answersVspace}[2]{\if@printanswers\vspace{#1}\else\vspace{#2}\fi}
\newenvironment{teacherfigure}[1][0pt]%
  {%
    \ignorespaces
    \if@printanswers\begin{figure}[p]\else
      \par\def\caption##1{}
      \vspace*{#1}%
      \setbox\z@\vbox\bgroup
    \fi
  }{%
    \if@printanswers\end{figure}\else
      \egroup
    \fi
    \ignorespaces
  }%
%\makeatother
