Created
September 13, 2010 23:22
-
-
Save alloy-d/578248 to your computer and use it in GitHub Desktop.
LaTeX class for homework and example usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\problem{\dpv}{7.18 a,b} | |
\subproblem | |
In the case where there are many sources and many sinks, we can reduce the | |
problem to the original problem with a single source and a single sink in | |
the following manner: | |
\begin{enumerate} | |
\item Choose one sink $s$ and one source $t$. | |
\item Replace each non-chosen source with a node $i$, and add edge $(s,i)$ | |
with capacity $\infty$. | |
\item Replace each non-chosen sink with a node $j$, and add edge $(j,t)$ with | |
capacity $\infty$. | |
\end{enumerate} | |
\subproblem | |
In the case where each vertex also has a capacity, we can reduce the | |
problem to the original problem with only edge capacities with the | |
following method: For each vertex $v$ with capacity $c_v$, create a vertex | |
$v'$ with all of $v$'s outgoing connections (remove these from $v$) and add | |
an edge $(v,v')$ with capacity $c_v$. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesClass{dsawork}[2009/02/04 Class for DSA homework] | |
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} | |
\ProcessOptions\relax | |
% Base on the standard article class | |
\LoadClass{article} | |
%\ProvidesPackage{dsawork} | |
\usepackage[noend]{algorithmic} | |
\usepackage{algorithm} | |
\usepackage{amsfonts} | |
\usepackage{amsmath} | |
\usepackage{amssymb} | |
\usepackage{amsthm} | |
\usepackage{mathabx} | |
%%% Header and footer definitions | |
\usepackage{fancyhdr} | |
\setlength{\headheight}{15.2pt} | |
\pagestyle{fancyplain} | |
\fancyhf{} % clear any preexisting settings | |
\lhead{\fancyplain{}{\problemmark}} | |
\chead{} | |
\rhead{\fancyplain{}{\vname}} | |
\lfoot{} | |
\cfoot{\thepage} | |
\rfoot{} | |
%%% end header/footer definitions | |
% define a problem mark for the header | |
\newcommand{\problemmark}{} | |
%%% Assigmnent-specific values | |
% name to put on title page and header - default to me, of course | |
\newcommand{\vname}{Adam Lloyd} | |
% class to put on title page - default to DSA | |
\newcommand{\vclass}{CSCI 2300} | |
% name of assignment - no sensible default, so it should be set manually | |
\newcommand{\vassignment}{} | |
% submission date - no senseible default, so it should be set manually | |
\newcommand{\vsubdate}{} | |
% commands to set the above values | |
\newcommand{\name}[1]{\renewcommand{\vname}{#1}} | |
\newcommand{\class}[1]{\renewcommand{\vclass}{#1}} | |
\newcommand{\assignment}[1]{\renewcommand{\vassignment}{#1}} | |
\newcommand{\subdate}[1]{\renewcommand{\vsubdate}{#1}} | |
% command to create a title page | |
% based on title page from The Not So Short Introduction to LaTeX2e | |
% by Tobias Oetiker (find at <http://tobi.oetiker.ch/lshort/>) | |
\newcommand{\mytitle}{ | |
\setcounter{page}{0} % don't interfere with page numbering | |
\newlength{\centeroffset} | |
\setlength{\centeroffset}{-0.5\oddsidemargin} | |
\addtolength{\centeroffset}{0.5\evensidemargin} | |
\thispagestyle{empty} % don't style the title page | |
\vspace*{\stretch{1}} | |
\noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth} | |
\flushleft | |
{\Huge\bfseries \vclass\\ | |
\vassignment | |
} | |
\noindent\rule[-1ex]{\textwidth}{5pt}\\[1.5ex] | |
\Large\vname\hfill\vsubdate | |
\end{minipage}} | |
\vspace{\stretch{1}} | |
\noindent\hspace*{\centeroffset}\makebox[0pt][l]{\begin{minipage}{\textwidth} | |
\flushleft | |
{\bfseries | |
% TODO: make collaborators and consulted works easier to add | |
Problems discussed with:\\[1ex] | |
\hspace{1em} Curtis Antolik \\[0.5ex] | |
\hspace{1em} Christian Schumacher \\[3ex] | |
Works consulted:\\[1ex] | |
\hspace{1em} \textit{Introduction to Algorithms}, 2nd ed. \\ | |
\hspace{2em} by Cormen \textit{et al.} \\[0.5ex] | |
\hspace{1em} \textit{Algorithms} \\ | |
\hspace{2em} by Dasgupta \textit{et al.} \\[0.5ex] | |
} | |
\end{minipage}} | |
\vspace{\stretch{2}} | |
} | |
\newcounter{ProblemCounter} | |
\newcommand{\problemnr}{ | |
\newpage | |
\stepcounter{ProblemCounter} | |
\renewcommand{\problemmark}{Problem \arabic{ProblemCounter}} | |
\thispagestyle{empty} | |
{\Large | |
\begin{flushleft} | |
\textbf{Problem \arabic{ProblemCounter}} | |
\end{flushleft} | |
} | |
} | |
\newcommand{\problem}[2]{ | |
\newpage | |
\stepcounter{ProblemCounter} | |
\renewcommand{\problemmark}{Problem \arabic{ProblemCounter}} | |
\thispagestyle{empty} | |
\begin{flushleft} | |
{\Large\textbf{Problem \arabic{ProblemCounter}}}\\ | |
{\scriptsize Problem #2 in #1} | |
\end{flushleft} | |
} | |
\newcounter{SubProblemCounter}[ProblemCounter] | |
\newcommand{\subproblem}{ | |
\stepcounter{SubProblemCounter} | |
\renewcommand{\problemmark}{Problem | |
\arabic{ProblemCounter}\alph{SubProblemCounter}} | |
\begin{flushleft} | |
{\large\textbf{Part \Alph{SubProblemCounter}}} | |
\end{flushleft} | |
} | |
\newtheorem*{giventheorem}{Theorem} | |
\renewcommand{\qedsymbol}{{\scriptsize Q.E.D.}} | |
\newcommand{\dpv}{Dasgupta \emph{et al.}} | |
\newcommand{\clrs}{Cormen \emph{et al.}} | |
%%% other miscellaneous commands | |
\newcommand{\ceil}[1]{\ensuremath{\left\lceil#1\right\rceil}} | |
\newcommand{\floor}[1]{\ensuremath{\left\lfloor#1\right\rfloor}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{dsawork} | |
\author{Adam Lloyd} | |
\class{CSCI 2300} | |
\assignment{Homework 8} | |
\subdate{27 Apr 2009} | |
\begin{document} | |
\mytitle | |
\input{problems/01.ltx} | |
\input{problems/02.ltx} | |
\input{problems/03.ltx} | |
\input{problems/04.ltx} | |
\input{problems/05.ltx} | |
\input{problems/06.ltx} | |
\input{problems/07.ltx} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment