From 6af85abd2d2bd25d225f76a8048b07fa288b1173 Mon Sep 17 00:00:00 2001 From: Thomas Ba Date: Sun, 25 Dec 2011 01:49:31 +0100 Subject: [PATCH] =?UTF-8?q?Uebung=201:=20Aufgabe=203=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Uebung_1/Uebung_1.tex | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Algorithmen_und_Datenstrukturen_2/Uebung_1/Uebung_1.tex b/Algorithmen_und_Datenstrukturen_2/Uebung_1/Uebung_1.tex index 9b6cfcc..5a4647b 100644 --- a/Algorithmen_und_Datenstrukturen_2/Uebung_1/Uebung_1.tex +++ b/Algorithmen_und_Datenstrukturen_2/Uebung_1/Uebung_1.tex @@ -25,7 +25,7 @@ breaklines=true, numberstyle=\textcolor{grey}, numbers=left, - morekeywords={Merge,ExtractMinimum,Union,NIL,return,and}, + morekeywords={Merge,ExtractMinimum,Union,NIL,return,and,InvertChildren,then}, tabsize=4, captionpos=b } @@ -146,6 +146,21 @@ ExtractMinimum(H): \section*{Aufgabe 3} \addcontentsline{toc}{section}{Aufgabe 3} -Leider keine Lösung vorhanden :-( +\begin{lstlisting}[frame=single] +InvertChildren(x): + head = NIL + current = child(x) + next = NIL + while ( current != NIL ) do + next = sibling(current) + if ( child(x) == current ) then + sibling(current) = NIL + child(x) = NIL + parent(current) = NIL + sibling(current) = head + head = current + current = next + return head +\end{lstlisting} \end{document}