aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-10-11 11:28:55 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2024-10-11 11:28:55 +0200
commit611ca75a476e8935e25204f5958d111e22da7d2a (patch)
tree2bfa40b4d3e21a16b0baf0c2efd203b04e59c6f6
parent03fc91c25262fda76602cc07adbc836c1b61e304 (diff)
downloadunterricht-611ca75a476e8935e25204f5958d111e22da7d2a.tar.gz
unterricht-611ca75a476e8935e25204f5958d111e22da7d2a.zip
simplify pseudo code, add solution and highlight the atelier
-rw-r--r--Info/11/NTG/1/Graphen_Implementierung/slides.md77
1 files changed, 69 insertions, 8 deletions
diff --git a/Info/11/NTG/1/Graphen_Implementierung/slides.md b/Info/11/NTG/1/Graphen_Implementierung/slides.md
index db4cbfa2..7bfc535a 100644
--- a/Info/11/NTG/1/Graphen_Implementierung/slides.md
+++ b/Info/11/NTG/1/Graphen_Implementierung/slides.md
@@ -388,9 +388,14 @@ Manfred der freundliche Minotaurus aus der Nachbarschaft braucht Hilfe in seinem
\textit{Das ist mein Zuhause!}
-\vspace{0.2cm}
+\vspace{0.1cm}
![](img/Manfreds_Labyrinth_01.png){height=70%}
-\vspace{0.2cm}
+\begin{tikzpicture}[overlay, remember picture]
+\only<2>{
+\node[anchor=north west, fill=magenta, opacity=0.5, minimum size=0.75cm] at (0.41, 3.98) {};
+}
+\end{tikzpicture}
+\vspace{-0.1cm}
> Welche Zimmer grenzen nochmal an mein Atelier (Zimmer 9)?
@@ -405,16 +410,72 @@ Manfred der freundliche Minotaurus aus der Nachbarschaft braucht Hilfe in seinem
### Tipp: Verwende folgende Pseudocode Bausteine
\begin{tikzpicture}[code/.style={draw, rounded corners=2pt, fill=gray!30}]
-\node[code, rotate=-2] at (3, -1) {für jeden Index < Anzahl der Knoten};
+\node[code, rotate=-2] at (3, -1) {für \texttt{index} < Anzahl der Knoten};
\node[code, rotate=2] at (0, 2) {falls Knotenbezeichnung gleich gesuchter Bezeichnung};
-\node[code, rotate=-1] at (-1, 0) {gibt aktuellen Index zurück};
+\node[code, rotate=-1] at (-1, 0) {gibt \texttt{index} zurück};
\node[code, rotate=3] at (-2, -1) {gibt -1 zurück};
-\node[code, rotate=-14] at (7.2, 1.9) {finde Index des Ausgangsknoten};
-\node[code, rotate=-1] at (7, 0) {für jeden Index < Anzahl der Knoten};
-\node[code, rotate=-3] at (3, 1) {falls Kante vorhanden in Zeile des Ausgangsknoten mit aktuellem Index};
-\node[code, rotate=1] at (1, 3) {gib Bezeichnung des Knotens an aktuellem Index aus};
+\node[code, rotate=-14] at (7.2, 1.9) {finde index des Ausgangsknoten};
+\node[code, rotate=-1] at (7, 0) {für \texttt{index} < Anzahl der Knoten};
+\node[code, rotate=-3] at (3, 1) {falls ausgehende Kante von Ausgangs- zu aktuellem Knoten};
+\node[code, rotate=1] at (1, 3) {gib aktuelle Knoten-Bezeichnung aus};
\end{tikzpicture}
+## \faIcon{pencil-alt} Lösung: Knoten finden
+
+::: {.columns align=top}
+:::: {.column width=45%}
+\vspace{0.5cm}
+```
+
+für index < Anzahl der Knoten
+ falls Knotenbezeichnung gleich
+ gesuchter Bezeichnung
+ gibt \texttt{index} zurück
+
+
+gibt -1 zurück
+```
+::::
+
+:::: {.column width=55%}
+```java
+int knotenFinden(String bezeichnung) {
+ for (int i = 0; i < anzKnoten; i++) {
+ if (knotenfeld[i].bezeichnung
+ == bezeichnung) {
+ return i;
+ }
+ }
+ return -1;
+}
+```
+::::
+:::
+
+## \faIcon{pencil-alt} Lösung: Nachbarn ausgeben
+
+`\begin{center}`{=latex}
+```
+finde index des Ausgangsknoten
+für index < Anzahl der Knoten
+ falls ausgehende Kante von Ausgangs- zu aktuellem Knoten
+ gib aktuelle Knoten-Bezeichnung aus
+```
+
+\vspace{0.2cm}
+
+```java
+void nachbarnAusgeben(String bezeichnung) {
+ int knotenIndex = knotenFinden(bezeichnung);
+ for (int i = 0; i < anzKnoten; i++) {
+ if (adjazenzmatrix[knotenIndex][i] != -1) {
+ println(knotenfeld[i].bezeichnung);
+ }
+ }
+}
+```
+`\end{center}`{=latex}
+
## \faIcon{desktop} Arbeitsauftrag: Nachbarn finden \hfill 15 min
Implementiere den entworfenen Algorithmus.