I am having a small issue where where the line
Let $s$ be the highest-ranked student in $h$'s preference list which $h$ has not yet requested to be a resident\
in my algorithm is wrapping a little too late. The boundary should be the same as the line under "Homework 1" provided by fancyhdr I believe. Below is that complete portion of me tex file. Could anyone assist me in getting that line to wrap earlier? If I force it with a newline then it will also give an incorrect line numbering for the algorithm environment so that quick fix isn't an option I am willing to settle with.
\begin{enumerate}
...
\item[\textbf{4.}]
Below is an algorithm to find a stable assignment of students to hospitals:
\begin{algorithm}[H]
\SetKwData{List}{list}
\SetKwFunction{Remove}{Remove}
\SetKwFunction{Insert}{Insert}
\SetKwInOut{Input}{input}
\Input{A set of hospitals $H$ where each $h \in H$ has a list of students $h.\List$ with a capacity equivalent to number of positions available \\ A set of students $S$}
Initially $s$ is free for all $s \in S$ and $h.\List$ is empty for all $h \in H$. \\
\While{there exists $h \in H$ such that $h.\List$ is not full}
{
Choose such a hospital $h$\\
\While{$h.\List$ is not full}
{
Let $s$ be the highest-ranked student in $h$'s preference list which $h$ has not yet requested to be a resident\\
}
}
\end{algorithm}
...
\end{enumerate}