\documentstyle[times,arpakey,a_acmproc2]{article}

\newcommand{\tabletab}[1]{\tabcolsep 3.7pt}
\newcommand{\figscale}[1]{\setlength{\unitlength}{1.6pt}}

\makeatletter
\long\def\unmarkedfootnote#1{{\long\def\@makefntext##1{##1}\footnotetext{#1}}}
\makeatother

\def\topfraction{1}
\def\bottomfraction{1}
\def\dpltopfraction{1}

\def\textfraction{.01}
\def\intextsep{14pt}

\input psfig
\input epsf

\def\figpath{final.fig}
\newtheorem{defi}{Definition}

\newtheorem{theo}[defi]{Theorem}
\newtheorem{algo}[defi]{Algorithm}
\newtheorem{lemm}[defi]{Lemma}
\newtheorem{assumption}[defi]{Assumption}
\newtheorem{coro}[defi]{Corollary}
\newtheorem{conj}[defi]{Conjecture}
\newtheorem{clai}[defi]{Claim}
\newtheorem{rema}[defi]{Remark}
\newtheorem{prop}[defi]{Proposition}
\newtheorem{ques}[defi]{Question}
\newtheorem{Principle}{Principle}[section]   % Specify Principle
\def\vec#1#2{#1_{1},\ldots,#1_{#2}}    % Defin. of vector 
\def\QED{\hfill$\Box$}

\newcommand{\lln}{\log\log n}
\newcommand{\slln}{\sqrt{\lln}}
\newcommand{\eff}{\mbox{\rm eff}}
\newcommand{\floor}[1]{\lfloor #1 \rfloor}
\newcommand{\ceiling}[1]{\lceil #1 \rceil}
\newcommand{\fln}{\lfloor \log n \rfloor}
\newcommand{\tim}{\!\!\times\!\!}
\newcommand{\interval}{\, .. \,}
\def\proof{\noindent{\bf Proof}:\ } 
\def\lar{\leftarrow}                  % leftarrow
\def\lra{\Leftrightarrow}             % leftarrow
\def\rar{\rightarrow}                 % rightarrow
\def\nl{\newline}
\def\mus{$\mu$s}
\def\ns{ns}
\def\ms{ms}



% definitions for algorithms
\newcommand{\UNTIL}[0]{{\bf until}}
\newcommand{\REPEAT}[0]{{\bf repeat}}
\newcommand{\REP}[0]{{\bf rep}}
\newcommand{\FOR}[0]{{\bf for}}
\newcommand{\DO}[0]{{\bf do}}
\newcommand{\IF}[0]{{\bf if}}
\newcommand{\IFF}[0]{{\bf iff}}
\newcommand{\THEN}[0]{{\bf then}}
\newcommand{\THE}[0]{{\bf the}}
\newcommand{\ALGORITHM}[0]{{\bf algorithm}}
\newcommand{\BEGIN}[0]{{\bf begin}}
\newcommand{\BEG}[0]{{\bf beg}}
\newcommand{\END}[0]{{\bf end}}
\newlength{\algindent}
\setlength{\algindent}{1.3em}
\newcounter{algS_c}
\newcounter{algG_c}

\newcommand{\algSCH}[8]{
\smallskip\par
\begin{center} \fbox{ 
\parbox{#1}{
\noindent
{\ALGORITHM} AS (simple, without ordering constraints)
\begin{list}{}{\setlength{\leftmargin}{\algindent} 
  \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}}
\item #2
\item #3
\item
{\UNTIL} #4 {\DO}
\begin{list}{}{\setlength{\leftmargin}{\algindent} 
  \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}}
\item {\FOR} #5 {\DO}
\begin{list}{}{\setlength{\leftmargin}{\algindent} 
  \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}}
\item  #6
\item  #7
\end{list}
\item #8
\end{list}
\end{list}
}}
\end{center}
\par\smallskip}


\newcommand{\algS}[9]{
\smallskip\par
\begin{center} 
	\fbox{ 
	  \parbox{3in}{
	  \noindent
	  {\ALGORITHM} #1
%	  \newline
	    \begin{list}{\arabic{algS_c}}{\usecounter{algS_c}
	    \setlength{\leftmargin}{\algindent} 
	    \setlength{\labelwidth}{10pt} 
	    \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{1pt}}
%	  \item #2;
	  \item #3;
	  \item #4;
	  \item #5;
	  \item #6;
	  \item #7;
	  \item #8;
	  \item #9;
	  \end{list}
	  }
	}
\end{center}
\par\smallskip}

\newcommand{\algG}[8]{
\smallskip\par
\begin{center} \fbox{ 
\parbox{#1}{
\noindent
{\ALGORITHM} #2
\begin{list}{\arabic{algG_c}}{\usecounter{algG_c}
  \setlength{\leftmargin}{\algindent} 
  \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}}
\item #3
\item #4
\item
{\FOR} #5
\begin{list}{}{\setlength{\leftmargin}{\algindent} 
  \setlength{\parsep}{0pt} \setlength{\topsep}{0pt} \setlength{\itemsep}{0pt}}
\item #6
\item #7
\end{list}
\item {\REPEAT} #8
\end{list}
}}
\end{center}
\par\smallskip}


