equal
deleted
inserted
replaced
5 |
5 |
6 \begin{document} |
6 \begin{document} |
7 |
7 |
8 \section*{Resit Exam} |
8 \section*{Resit Exam} |
9 |
9 |
10 The Scala part of the exam is worth 30\%. It is about `jumps' |
10 The Scala part of the exam is worth 50\%. It is about `jumps' |
11 within lists. |
11 within lists. |
12 |
12 |
13 \IMPORTANTEXAM{} |
13 \IMPORTANTEXAM{} |
14 |
14 |
15 \DISCLAIMEREXAM{} |
15 \DISCLAIMEREXAM{} |
107 \begin{center} |
107 \begin{center} |
108 {\large[}\;[2,0,1], [0,1],\; [1]\;{\large]} |
108 {\large[}\;[2,0,1], [0,1],\; [1]\;{\large]} |
109 \end{center} |
109 \end{center} |
110 |
110 |
111 |
111 |
112 \mbox{}\hfill[Marks: 8\%] |
112 \mbox{}\hfill[Marks: 12\%] |
113 |
113 |
114 \item[(2)] Write a function \texttt{search} that tests whether there |
114 \item[(2)] Write a function \texttt{search} that tests whether there |
115 is a way to reach the end of a list. This is not always the |
115 is a way to reach the end of a list. This is not always the |
116 case, for example for the list |
116 case, for example for the list |
117 |
117 |
123 there is no sequence of steps that can bring you to the end of the list. |
123 there is no sequence of steps that can bring you to the end of the list. |
124 If there is a way, \texttt{search} should return true, otherwise false. |
124 If there is a way, \texttt{search} should return true, otherwise false. |
125 In case of the empty list, \texttt{search} should return true since the |
125 In case of the empty list, \texttt{search} should return true since the |
126 end of the list is already reached. |
126 end of the list is already reached. |
127 |
127 |
128 \mbox{}\hfill\mbox{[Marks: 10\%]} |
128 \mbox{}\hfill\mbox{[Marks: 18\%]} |
129 |
129 |
130 \item[(3)] Write a function \texttt{jumps} that calculates the |
130 \item[(3)] Write a function \texttt{jumps} that calculates the |
131 shortest sequence of steps needed to reach the end of a list. One |
131 shortest sequence of steps needed to reach the end of a list. One |
132 way to calculate this is to generate \emph{all} sequences to reach |
132 way to calculate this is to generate \emph{all} sequences to reach |
133 the end of a list and then select one that has the shortest length. |
133 the end of a list and then select one that has the shortest length. |
136 exists a sequence at all. If there exists such a sequence, |
136 exists a sequence at all. If there exists such a sequence, |
137 \texttt{jumps} should return \texttt{Some(\ldots)}; otherwise |
137 \texttt{jumps} should return \texttt{Some(\ldots)}; otherwise |
138 \texttt{None}. In the special case of the empty list, \texttt{jumps} |
138 \texttt{None}. In the special case of the empty list, \texttt{jumps} |
139 should return \texttt{None} |
139 should return \texttt{None} |
140 |
140 |
141 \mbox{}\hfill\mbox{[Marks: 12\%]} |
141 \mbox{}\hfill\mbox{[Marks: 20\%]} |
142 |
142 |
143 \end{itemize}\bigskip |
143 \end{itemize}\bigskip |
144 |
144 |
145 |
145 |
146 \noindent |
146 \noindent |