



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Exercises Problem Sheet
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Time allowed 1 hour 30 minutes
Candidates may complete the front cover of their answer book and sign their desk card but must NOT write anything else until the start of the examination period is announced.
Answer THREE questions. Marks available for sections of questions are shown in brackets in the right-hand margin.
Dictionaries are not allowed with one exception. Those whose first language is not English may use a standard translation dictionary to translate between that language and English provided that neither language is the subject of this examination. Subject specification translation dictionaries are not permitted.
No electronic devices capable of storing and retrieving text, including electronic dictionaries, may be used.
DO NOT turn examination paper over until instructed to do so
INFORMATION FOR INVIGILATORS: The final page (containing figs. 5.1 and 5.2) should be handed in with the examination book at the end of the examination. Please ensure that both are securely tied together.
G51APS-E1 Turn over
1 a) Figure 5.1 (at the end of this examination paper) shows an acyclic graph. The top-left node has been marked ”start” and the bottom-right node has been marked ”finish”. Calculate the number of distinct paths from start to finish. Explain clearly the method you use, being careful to explain precisely what you are counting, how the counting process is started and how it then proceeds. (10) (You may wish to annotate the supplied figure when answering the question. Add your student identity number at the top of the page and fasten it securely to your examination book.) b) Four people wish to cross a bridge. It is dark, and it is necessary to use a torch when crossing the bridge, but they only have one torch between them. The bridge is narrow and at most 2 people can be on it at any one time. The people are numbered from 1 thru 4. Person i takes time ti to cross the bridge; when two cross together they must proceed at the speed of the slowest. One strategy for getting everyone across the bridge is for the fastest person to accompany the other three one-by-one across the bridge, returning with the torch after each crossing. What is the total time taken if this strategy is adopted? (3) There is an alternative strategy for getting the people across the bridge. What is this strategy? What is the total time taken if this strategy is adopted? (3) Suppose you want to get everyone across as quickly as possible. When would you use the first strategy? When would you use the second strategy? (4) Give two examples of crossing times. The examples should demonstrate when each of the two strategies is optimal. (5)
2 Full marks for the following question can only be obtained by not using case analysis.
On the island of knights and knaves there are two types of native, knights and knaves. Knights always tell the truth and knaves always lie. a) If a native makes a (true or false) statement, what can you infer? In your answer, use S for the boolean value of the statement, and A for the boolean value of ”the native is a knight”. (5) b) If a question is posed to a native, what can you infer from the response? Use Q for the boolean value of the question, R for the boolean value of the response, and A for the boolean value of ”the native is a knight”. (5) c) Suppose there are two natives. One of the natives makes the statement ”we are both knights”. Suppose you then ask the second native the question ”are both of you knaves?”. What response would you get? (5) d) Suppose there are two natives. The first native makes the statement ”I am a knight if we are both knaves.” Formulate and simplify the native’s statement. Use A for the boolean value of ”the first native is a knight”, and B for the boolean value of ”the second native is a knight”. Suppose you ask the second native ”is it also the case that you are a knight if you are both knaves?”. Formulate and simplify the response. (10)
Left Game Right Game “losing” or winning move Q 7? K 22? F 9? L 9? D 8?
Table 4.1 Fill in entries marked “?”
5 Suppose you have a balance and “widgets” of weights 30 , 31 , 32 ,... , 3 n^ ,... , one of each weight. Suppose you are given a “fudget”, which is claimed to have weight w , where w is a strictly positive natural number. By placing the fudget on one side of the balance together with a number (possibly zero) of widgets, and placing a number of widgets on the other side of the balance, it is possible to check the claimed weight. For example, to check whether or not w is 34 , the fudget and the widget of weight 3 should be placed on one side of the balance, and the widgets of weights 1 , 9 and 27 should be placed on the other side of the balance. If the balance does not tip to either side, w+3 = 1+9+27 , i.e. w = 34. This question is about an inductive method to determine how to choose and place the widgets in order to check whether or not a fudget has weight w. a) Suppose you have n+1 widgets with weights 30 , 31 , 32 ,... , 3 n^. Show by induction on n that the maximum weight that can be checked is (3n+1−1)/ 2. (5) b) Suppose w is such that (3n+1−1)/ 2 < w ≤ (3n+2−1)/ 2. Note that this means that at least n+ widgets are needed to check the weight w. Calculate numbers a and b such that a ≤ w− 3 n+1^ ≤ b. (Take careful note in these formulae of where “ < ” is used and where “ ≤ ” is used.) (5) c) In your solution to part (b), the value of a is negative. Thus the range of w− 3 n+1^ can be divided into three distinct ranges, namely where w− 3 n+1^ equals zero, where it is less than zero, and where it is greater than zero. Use this to formulate an inductive method to check a given weight w. In the induction step, assume you have an algorithm to check all fudgets with weights at most (3n+1−1)/ 2 ; assume that the algorithm is parameterised by the side s of the balance on which the fudget is placed. Consider the effect of placing the fudget on side s and the widget of weight 3 n+1^ on side ¬s (the opposite side). (5) d) Complete the following table showing how to use the widgets to weigh various weights. The table assumes that the fudget is placed on the left side. Two rows have been completed as illustration. Your solution to earlier parts of this question should help you to complete this task. (10)
Weight of Fudget Left Side Right Side 34 31 30 +3^2 +3^3 47 30 +3^2 +3^3 31 +3^4 46?? 17?? 72?? 36?? 55??
Table 5.1 Fill in entries marked “?”
Figure 5.1 Question 1. Count the paths from start to finish.
Figure 5.2 Question 4. Label each position with its mex number.
G51APS-E1 End