National University of Singapore: School of Computing Final Examination For Semester 1 AY2009/10
National University of Singapore: School of Computing Final Examination For Semester 1 AY2009/10
National University of Singapore: School of Computing Final Examination For Semester 1 AY2009/10
SCHOOL OF COMPUTING FINAL EXAMINATION FOR Semester 1 AY2009/10 CS1231 - DISCRETE STRUCTURES
November 2009 Time Allowed: 2 Hours
INSTRUCTIONS TO CANDIDATES
1. This examination paper contains FOUR (4) parts and comprises FIFTEEN (15) printed pages, including this page. 2. Answer ALL questions as indicated. 3. UNNECESSARY comments will be penalized. 4. This is a RESTRICTED OPEN BOOK examination. 5. Please write your Matriculation Number below.
MATRICULATION NUMBER:
(51231
This is a series of multiple choice questions (Part I) and short essay questions (Part II, III and IV). For each multiple choice question choose the best answer and report the corresponding choice onto the OCR form. Each multiple choice question is worth 3 points. No point is deducted for wrong answers. Shade your matriculation number on the OCR form. For each short essay question give your answer in the reserved space in the script. Points are deducted for unnecessary comments and wrong answers but there cannot be a negative mark for a question.
Part I
(54 points) Multiple choice questions. Answer on the OCR form. The next five (5) questions are miscellaneous questions.
1. (3 points) Which of the following formulae is logically equivalent to (.p V q) /\ (.p Vr)?
a. p =} (r /\ q).
b. (p/\q) /\ (r
=}
p).
c. (.p /\ q) V (p /\ .r).
d. all of the above. e. none of the above. 2. (3 points) Which of the following are rows of the truth table of (p tions (p, q, r) in this order? a. true, false, true, false.
b. true, true, false, true. c. false, true, false, false.
=}
(q
=}
(r
=}
d. All of the above. e. None of the above. 3. (3 points) Which of the following formulae translates into" All integers are multiples of 1".
a. 'tin E N 3m E N (n = 1 x m).
b. 'tin (n EN=} (3m (m E N /\ n
= 1 x mm.
c. 'tin E N (n
= 1 x n).
d. All of the above. e. None of the above. 4. (3 points) Which of the following formulae is logically equivalent to the formula:
3X (P(X) V q(X))?
Page 2
(51231
VI
Vs
010 100 10011 1 00001 1 1 1 0 010 011101 o 1 1 010
Figure 1: Completing this graph may help you in answering the questions. For the next eight (8) questions, consider the following undirected graph G with its vertices ordered as V(G) = {VI, V2, V3, V4, VS, V6}. The adjacency matrix of G is the 6 x 6 matrix A(G) =
Before you answer the following questions, it is advised that you complete the graph on Figure 1 by drawing the edges. 5. (3 points) What is the total number of edges of G?
a. 9.
b. 18.
c. 36.
d. 72.
e. 144.
6. (3 points) What is the sum of degrees of all vertices of G? a.9. b. 18. c. 36.
d. 72.
e. 144. 7. (3 points) What is the length of the longest trail in G? a. 5.
b. 6.
c. 9.
d. 18.
e. 36.
Page 3
b.2.
c. 3.
d.6.
e. 12. 9. (3 points) Which of the following is a walk of length 3 from
VI
to V2 in G?
a.
b.
VI V2 VI V2. VI V4 V5 V2'
e. None of the above. 10. (3 points) Which of the following is a trail of length 3 from
VI
to V2 in G?
a.
b.
c.
VI V2 VI V2 VI V4 V5 V2' VI V2 V6 V2
a. {{VI,V2},{V2,V6},{V3,V6},{V3,V5},{V4,V5}}.
b.
{{VI,V4},{V2,V4},{V2,V5},{V5,V6},{V3,V6}}'
c. {{VI,V2},{V2,V4},{V2,V6},{V5,V6},{V3,V6}}. d. All of the above. e. None of the above. 12. (3 points) Which of the following sequence is NOT a Hamilton path in G?
a.
b.
VI V2 V6 V3 V5 V4 . VI V4 V2 V5 V6 V3 .
C. V2 V5 V6 V3 V5 V4 VI .
d. All of the above. e. None of the above. For the next six (6) questions, consider the following task allocation problem: Suppose that there are R robots of the same capabilities and T different tasks where R and T are strictly positive integers. Then, the task allocation problem involves assigning all the R robots to the T tasks. In particular, if we let ri denote the number of robots assigned to task i where ri is a non-negative integer (i.e., ri ~ O. In other words, task i can be assigned no robots) for i = 1, ... , T, then ~'J=I ri = R. 13. (3 points) What is the number of ways to assign all 3 robots to 2 tasks (i.e., R
= 3 and T = 2)?
a. C(4,3).
b. C(3,2).
c. C(5,3).
d. P(3,2).
e. 23 .
Page 4
(51231 14. (3 points) What is the number of ways to assign all 11 robots to 3 tasks (Le., R = 11 and T = 3)? a. C(11,3).
b. C(14,11).
c. C(13,11). d. P(11,3).
e. 311 . 15. (3 points) What is the number of ways to assign all 11 robots to 3 tasks (Le., R such that task 1 has to be assigned at least 7 robots (Le., Tl 2:: 7)? a. C(6,4). b. C(7,3).
c. C(4,3).
= 11
and T
= 3)
d. P(4,3).
e. 34 .
16. (3 points) What is the number of ways to assign all 11 robots to 3 tasks (Le., R such that task 2 has to be assigned at least 4 robots (Le., TZ 2:: 4)? a. C(10,3).
b. C(7,3). c. C(9,2).
= 11
and T
= 3)
d. C(4,3).
e. 37 ,
17. (3 points) What is the number of ways to assign all 11 robots to 3 tasks (Le., R = 11 and T = 3) such that task 2 and task 3 have to be assigned at least 4 and 5 robots, respectively (Le., TZ 2:: 4 and T32:: 5)? a. C(5,2).
b. C(4,2). c. C(9,3).
d. P(5,2). e. 32 . 18. (3 points) What is the number of ways to assign all 11 robots to 3 tasks (Le., R = 11 and T = 3) such that task 1, task 2, and task 3 have to be assigned at most 6, 3, and 4 robots, respectively (Le., Tl S 6, T2 S 3 and T3 S 4)? You may want to use the results from questions 14 to 17 to help you in answering this question. a. O.
b.6.
c. 15.
d. 36.
e, 78.
Page 5
C51231
Part II
(21 points) Short essay questions. Answer in the space provided on the script. The problem of friends and politicians is presented in the book "Proofs from the book" by M. Aigner and G.M. Ziegler. It states that "in a group of people, we have the situation that any pair of persons have precisely one common friend. Then there is always a person (the 'politician') who is everybody's friend". The resulting undirected graph, in which vertices represent persons and edges represent the friendship relationship, is called a windmill graph. We assume that the friendship relationship is not reflexive (one is not one's own friend). Let n be the number of vertices of a windmill graph. Notice, without proof, that n must be odd. For example, the graph on Figure 2 is a windmill graph for n = 5.
1. (2 points) Draw the windmill graph for n = 3.
Solution:
Page 6
3. (3 points) What is the maximum length of the shortest path between two persons in a windmill graph? Explain briefly.
Solution:
4. (2 points) What is the maximum degree of the vertices in a windmill graph? Explain briefly.
Solution:
Page 7
(51231 5. (2 points) From the examples and the definition above, guess the degree of every vertex other than the politician?
Solution:
6. (2 points) Prove, using the answers to questions 3 and 4, that the total number of edges in a windmill graph is 3(n - 1)/2. Note that no points will be awarded for not using the answers to questions 3 and 4.
Solution:
Page 8
(51231 7. (3 points) Prove that there is no square (Le., cycle of length 4) in a windmill graph. Give a proof by contradiction.
Solution:
8. (2 points) Propose, without proof, a formula for the number of triangles (cycles of length 3) in a windmill graph with n vertices.
Solution:
Page 9
Page 10
(51231
s/
S2
S3
2
5'5
S4
S6
2 5
S7 S8
6
4
S9
Part III
(8 points) Short essay questions. Answer in the space provided on the script.
Consider the following sensor network problem: a network of 9 static sensors is modeled using the weighted undirected graph G in Figure 3 such that each vertex represents a sensor, each edge represents a communication link, and the weight of each edge represents the communication cost. 1. (4 points) Give the vertex set of a spanning tree of minimum cost for graph G in Figure 3.
Solution:
V(G)
Page 11
(51231 2. (2 points) Give the edge set of a spanning tree of minimum cost for graph G in Figure 3. Solution:
E(G)
3. (2 points) State the cost of the minimum spanning tree for graph G in Figure 3. Solution:
Page 12
(51231
Part IV
(17 points) Short essay questions. Answer in the space provided on the script. Let n E N \ {O}. Let mEN \ {O}. The m th power of n is the natural number n m = words n m =!" x . ~. x r0.
m
We shall use without proofs the following facts as well as other known properties of natural numbers and operations on natural numbers.
We define the relation =: on (N \ {O}) x (N \ {O}) such that < nl> n2 >=:< mI, m2 > iff n~2
= m~2.
1. (2 points) Is it true that < 1,3 >=:< 1,5 >? Tick the square corresponing to your answer (YES or NO) then briefly justify your answer. Solution: YES D
NOD
2. (2 points) Is it true that < 5,3 >=:< 3,5 >? Tick the square corresponing to your answer (YES or NO) then briefly justify your answer.
Solution: YES D NOD
3. (2 points) Give an example of two t-uples that are different and equivalent (other than those of the preceeding questions)? Briefly justify your answer.
Solution: <
>=:<
>
Page 13
(51231
4. (2 points) Prove that == is reflexive.
Page 14
(51231 7. (2 points) == is an equivalence relation. Propose a way to label the equivalence classes of
Solution:
_ _ _ _ _ _ _ _ _ _ _ _ _ END OF PAPER
Page 15