\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{pset}
\LoadClass[12pt]{article}

\RequirePackage[noend]{algorithm,algpseudocode}

% Page layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\topmargin 0pt
\advance \topmargin by -\headheight
\advance \topmargin by -\headsep

\textheight 8.9in

\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in

\textwidth 6.5in


\pagestyle{empty}
\setlength{\oddsidemargin}{0in}
\setlength{\topmargin}{-0.8in}
\setlength{\textwidth}{6.8in}
\setlength{\textheight}{9.5in}


\setlength{\parindent}{0in}
\addtolength{\parskip}{0.1cm}
\setlength{\fboxrule}{.5mm}\setlength{\fboxsep}{1.2mm}
\newlength{\boxlength}\setlength{\boxlength}{\textwidth}
\addtolength{\boxlength}{-4mm}

% Assignment header %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\@psname}{}
\newcommand{\psname}[1]{\renewcommand{\@psname}{#1}}
\newcommand{\psnum}[1]{\psname{Problem Set #1}}

\renewcommand{\@date}{}
\renewcommand{\date}[1]{\renewcommand{\@date}{#1}}
\newcommand{\psdue}[1]{\date{Due at 11pm, #1}}

\renewcommand{\maketitle}{
	\begin{center}\framebox{\parbox{\boxlength}{\bf
		Introduction to Analysis of Algorithms
		\hfill \@psname
		\\ 
		CS 4820, Summer 2013
		\hfill \@date
	}}
	\end{center}
	\vspace{5mm}
}

\newcommand{\standardadvice}{
	{\bf Hand in your solutions electronically using CMS and submit a paper
	copy in class.  Write your name and NetID on the first page.

	Remember that when a problem asks you to design an
	algorithm, you must also prove the algorithm's 
	correctness and analyze its running time.  The
	running time must be bounded by a polynomial
	function of the input size, unless specified otherwise.
	}
	\bigskip
}

% Problems and solutions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{problem}
\newcounter{subproblem}

\newcommand{\bracket}[1]{\ifx#1\empty\else[#1]\fi}

\newenvironment{problem}[1][]{%
	\addtocounter{problem}{1}%
	\setcounter{subproblem}{0}%
	{\bf \arabic{problem}.} \bracket{#1}%
} {%
}

\newenvironment{subproblem}[1][]{%
	\addtocounter{subproblem}{1}%
	(\alph{subproblem}) \bracket{#1}%
} {%
}

\newenvironment{solution}[1][]{
	\medskip%
	\rm%
	\begin{quotation} Solution.%
} {%
	\end{quotation}
}


%
% vim: syntax=tex
%
