Browse Source

added algodat questions

master
Joerg Kreiker 7 years ago
parent
commit
7b074cdffd
  1. 33
      gsd-questions.tex

33
gsd-questions.tex

@ -88,6 +88,39 @@ Musterloesung here
\section{Algorithms and Data Structures}
\subsection{In-situ List Reversal}
Describe an algorithm to reverse a singly-linked list that \emph{does not}
copy any memory cells.
\ifdefined\loesung
{\bf Solution}: Maintain three pointers following each other: current, next, and
previous. The first pointer is one element ahead of the second. Reverse each pointer
as you you.
\fi
\subsection{Preorder Tree Traversal}
Consider the following tree and state the \emph{preorder} and \emph{inorder} traversal.
\begin{verbatim}
5
/ \
7 4
\ / \
1 2 9
\end{verbatim}
Which data structure do you need to implement such a traversal?
\ifdefined\loesung
{\bf Solution}: Preorder: 5, 7, 1, 4, 2, 9; Inorder: 7, 1, 5, 2, 4, 9.
Such traversals are implemented using a stack (explicitly or implicitly using
a recursive traversal)
\fi
\subsection{Breadth-First-Search}
What is the BFS traversal of the tree above? Which data structure is needed to implement
such a traversal?
\ifdefined\loesung
{\bf Solution}: BFS: 5, 7, 4, 1, 2, 9. You need a queue to implement BFS.
\fi
\section{Networking}
\section{Regular Expressions and Shells}

Loading…
Cancel
Save