\documentstyle{report}
\pagestyle{myheadings}
\def\headlineaux{\sc Math 220/317: Programming II/Data Structures 
\hrulefill
}
\markboth{\headlineaux}{\headlineaux}

\newcommand{\assignmentNumber}{7}
\newcommand{\outdate}{14 November, 1995}
\newcommand{\duedate}{28 November, 1995}

\begin{document}
\begin{titlepage}\begin{centerline}{\Huge \framebox{Burt Rosenberg}}
\end{centerline}\end{titlepage}

\section*{Problem Set \assignmentNumber \hfill{\parbox{3in}
    {\small\sc\begin{flushright} Out: \outdate
     \\ Due: \duedate\end{flushright}}}}

\subsection*{Rabin--Karp String Searching}

Implement the Rabin--Karp string searching algorithm, where you program,
\verb.my-grep., accepts two command line arguments, a string to search,
and a filename to search in.
\begin{verbatim}
        my-grep find-this-string in-this-file
\end{verbatim}
The output is a line number and the line for each matching string
found. For extra-credit write the program so that
if given just one argument, the program accepts input from stdin (filter mode).

The Rabin--Karp algorithm was described in class. Here it is again: hash the
input string and compare the hash value to the hash values of equal lengthed
substrings from the file. Methodically test the hash value against all
equal lengthed substrings from the input file by incrementally updating the
hash value as you walk character by character through the file.
When the hash values match, test the input string and file substring directly
for a complete and exact match.

Use this hash function:
\[ x = a[i] d^{M-1}+ a[i+1] d^{M-2} + \ldots + a[i+M-1] \pmod{Q},
\]
where $d=32$ and $Q=33554393.$

\end{document}

find the longest string of non-zero's in an array, 0 and 0 in first and last,
for convenience

euclidean algorithm, or something like that.

