Answer:
To add input and output before MyProcedure a possibility is to add the text before \begin{algorithmic}
with starred hspace \hspace*{}
(see 6.3.3 Horizontal Space) and the indentation \algorithmicindent
(see 4.1 Blocks and loops). LaTeX normally removes horizontal space at the beginning of a line, to preserve this space, use the starred version.
...
\hspace*{\algorithmicindent} \textbf{Input} \\
\hspace*{\algorithmicindent} \textbf{Output}
\begin{algorithmic}[1]
...
Complete full MWE:
A minimal working example (MWE) starts with \documentclass
and ends with \end{document}
.
To complete the MWE and to avoid the following error:
! Undefined control sequence. \BState ->\State \algbackskip l.24
\BState
You have to use the following definition (the solution is from @Werner see: Undefined control sequence.\BState ->\State \algbackskip \BState):
\makeatletter
% Reinsert missing \algbackskip
\def\algbackskip{\hskip-\ALG@thistlm}
\makeatother
MWE:
\documentclass{article}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\makeatletter
% Reinsert missing \algbackskip
\def\algbackskip{\hskip-\ALG@thistlm}
\makeatother
\begin{document}
\begin{algorithm}
\caption{My algorithm}\label{euclid}
\hspace*{\algorithmicindent} \textbf{Input} \\
\hspace*{\algorithmicindent} \textbf{Output}
\begin{algorithmic}[1]
\Procedure{MyProcedure}{}
% \Procedure{MyProcedure}{$x,y$}
% % Input:
% \Comment{Input: x}
% % Output:
% \Comment{Output:y}
\State $\textit{stringlen} \gets \textit{length of } \textit{string}$
\State $i \gets \textit{patlen}$
\BState \emph{top}:
\If {$i > \textit{stringlen}$} \Return false
\EndIf
\State $j \gets \textit{patlen}$
\BState \emph{loop}:
\If {$\textit{string}(i) = \textit{path}(j)$}
\State $j \gets j-1$.
\State $i \gets i-1$.
\State \textbf{goto} \emph{loop}.
\State \textbf{close};
\EndIf
\State $i \gets i+\max(\textit{delta}_1(\textit{string}(i)),\textit{delta}_2(j))$.
\State \textbf{goto} \emph{top}.
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
Alternative: You can add the input and output after MyProcedure
with \Procedure{MyProcedure}{$x,y$}
...
or \Comment{Input: x}
/\Comment{Output: y}
.
\Procedure{Algo name}{$x,y$}
. Or\Comment{Input: }
and\Comment{Output:}
algorithm
, but Steven do not respond to comments. Nevertheless i added some ideas.