summaryrefslogtreecommitdiff
path: root/ss2016/algodat/01/H1-1.md
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-04-19 15:21:02 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-04-19 15:21:02 +0200
commita61b998270e8f955c603de96775e072a555f735d (patch)
treec89c8cd2ecab33eecc4fefb4a8089a8df208d17a /ss2016/algodat/01/H1-1.md
parent6e70a46771d3b28edc80a88de22b98df47147dc1 (diff)
downloaduni-a61b998270e8f955c603de96775e072a555f735d.tar
uni-a61b998270e8f955c603de96775e072a555f735d.tar.gz
uni-a61b998270e8f955c603de96775e072a555f735d.tar.bz2
uni-a61b998270e8f955c603de96775e072a555f735d.tar.xz
uni-a61b998270e8f955c603de96775e072a555f735d.zip
AlgoDat 01
Diffstat (limited to 'ss2016/algodat/01/H1-1.md')
-rw-r--r--ss2016/algodat/01/H1-1.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/ss2016/algodat/01/H1-1.md b/ss2016/algodat/01/H1-1.md
new file mode 100644
index 0000000..d93f86c
--- /dev/null
+++ b/ss2016/algodat/01/H1-1.md
@@ -0,0 +1,32 @@
1a)
2
3\begin{algorithmic}[1]
4 \FORALL{entries $e$ on the shopping list}
5 \STATE{$c \leftarrow \text{category of $e$}$}
6 \STATE{Go to shelf $s$ labeled $c$}
7 \FORALL{products $p$ on $s$} \label{alg:loopstart}
8 \IF{$p$ matches $e$}
9 \STATE{add $p$ to shopping basket}
10 \STATE{break out of loop started in line \ref{alg:loopstart}}
11 \ENDIF
12 \ENDFOR
13 \ENDFOR
14\end{algorithmic}
15
16b)
17
18\begin{algorithmic}[1]
19 \WHILE{not at destination within forest}
20 \STATE{break crumb of bread}
21 \STATE{drop crumb}
22 \STATE{take step towards destination}
23 \ENDWHILE
24 \WHILE{not out of forest}
25 \IF{we see at least one crumb}
26 \STATE{Go to the closest one}
27 \STATE{Pick it up}
28 \ELSE
29 \STATE{Get eaten by a witch}
30 \ENDIF
31 \ENDWHILE
32\end{algorithmic}