\documentclass[12pt]{article}

\usepackage{fullpage,amsmath,amsfonts,hyperref}

\begin{document}

\title{Algorithms and Data Structures}
\author{Summer Semester 2024}
\date{For discussion on Wednesday, May 22, 2022}
\maketitle

\begin{enumerate}

\item In class, we took the file
\begin{center}
\scriptsize
\url{https://github.com/mjwestcott/Goodrich/blob/master/ch07/doubly_linked_base.py}
\end{center}
as a template to implement a \texttt{Stack} class.  You can find the
resulting code at
\begin{center}
\scriptsize
\url{https://mids.ku.de/oliver/teaching/ku/summer2024/algorithms/code/2024-05-15_stack.py}
\end{center}
Using a similar approach, implement a \texttt{Queue} class in Python
that uses a linked list internally.

\item (GTG Exercise R-6.5) Implement a function that reverses a list
of elements by pushing them onto a stack in one order, and writing
them back to the list in reversed order.

\item (GTG Exercise R-6.8) Suppose an initially empty queue $Q$ has
executed a total of $32$ enqueue operations, $10$ first operations,
and $15$ dequeue operations, $5$ of which raised \texttt{Empty} errors
that were caught and ignored. What is the current size of $Q$?


\item (GTG Exercise C-6.20) Describe a nonrecursive algorithm for
enumerating all permutations of the numbers $\{1, 2, \dots, n\}$ using
an explicit stack.


\item (GTG Exercise C-6.21) Show how to use a stack $S$ and a
queue $Q$ to generate all possible subsets of an $n$-element set $T$
nonrecursively.

\end{enumerate}
\end{document}
