2003 D
2003 D
FACULTY OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION SYSTEMS
Candidates may use any calculator which fulfils the following criteria: (a) it should be
selj~contained, silent, battery-operated and pocket-sized; (b) it should have numeral-
display facilities only and should be used only for the purpose of calculation; ( c) it should
not have any printing device, alphanumeric keyboard, or graphic display; and ( d) it
should not contain any recorded data or program. It is the candidate's responsibility to
ensure that the calculator operates satisfactorily and the candidate must record the name
and type of the calculator on the front page of the examination scripts. Lists of
permitted/prohibited calculators will not be made available to candidates for reference,
and the onus will be on the candidate to ensure that the calculator used will not be in
violation of the criteria listed above.
Answer ALL questions. Each question carries 10 points. Total score is 130 points.
Question 1
(a) Let T be the set of all triangles in the plane. For t 1 and t 2 E T, define ti 9\ t2 if ti, t2
have the same area. Determine whether 9\ is an equivalence relation or a partial
ordered relation.
(b) Let T be the set of all triangles in the plane. For t 1 and t2 E T, define t1 9\ t2 if t1 has
an area larger than or equal to the area of t2 . Determine whether 9\ is an equivalence
relation or a partial ordered relation.
Question 2
(b) List the functions below from lowest order to highest order n, 2n, nlogn, logn,
7 n 5-n 3+n, _-Yn,
I n 2+1ogn, (1 ogn )2 , n l..
. ... ./Question 3
Question 3
Determine and prove the truth-value for each of the following statements.
(i) Vy p(O, y)
(ii) 3y p(l, y)
(iii) Vx 3y p(x, y)
(iv) 3y Vx p(x, y)
(v) Vy 3x p(x, y)
Question 4
Let S be a set of five positive integers the maximum of which is at most 9. Prove that the
sums of the elements in all non-empty subsets of S cannot all be distinct.
[Hint: (1) Are all the integers in S distinct? (2) Consider all the subsets of size 3 or less,
i.e., compare the number of these subsets and maximum sum af a subset of si::.e 3.]
Question 5
(a) Which is more likely: rolling a total of 9 when two dice are rolled or rolling a total of
9 when three dice are rolled. Give a proof for your claim.
(b) What is the conditional probability that a randomly generated bit-string of length
four contains at least two consecutive Os given that the first bit is a 1. (Assume the
probabilities of a 0 and a 1 are the same.)
.... ./Question 6
2
Question 6
Question 7
In how many ways can six identical (indistinguishable) balls are assigned to three bins {A,
B, C} if
(i) each bin contains any number of balls
(ii) each bin contains at least one ball
(iii) each bin contains at least two balls
(iv) bin A contains at least four balls
(v) each bin contains at most three balls [Hint: inclusion and exclusion]
Question 8
Determine which of the graphs in following figures are planar. Prove your claim.
a a
d b
d c
.... ./Question 9
3
Question 9
(a) Model this problem by a graph, i.e., define V and E of the graph and state the graph
problem corresponding to the knight's tour problem.
(c) Show that there does not exist a knight's tour when n is odd.
Question 10
(a) A domino is a rectangular block divided into two squares with each square numbered
one of 0, 1, 2, 3, 4, 5, 6 (see the figure for examples). Two squares on a single
a·. 8B::
domino can have the same number.
(i) Kn.m
(ii) Wheel Wn
(iii) Full m-ary tree
(iv) Multi-stage graph where Vis partitioned in m sets, Vi, V2, ... , Vm and edges are
only connected between Vi and Vi+l where 1 :::; i < m.
(v) Planar graph
.... ./Question 11
4
Question 11
(a) Let T be a binary tree with n vertices, what is the maximum height that T can attain?
What is the minimum height? Give the drawings in these two cases.
(b) Let T be a binary search tree for 3 elements, each with an accessing probability.
(i) Give a situation that the maximum height tree will give the minimum cost tree?
(ii) Give a situation that the minimum height tree will give the minimum cost tree?
Prove your claim.
[Note that a minimum cost tree gives the lowest expected number of comparisons for
searching.]
Question 12
Given a text and a pattern formed from the alphabet {A, B, C}, the pattern matching
problem is to find the position in the text where the pattern occurs. With the help of finite
state machine, the pattern can be found efficiently.
Question 13
(a) Draw the state diagram for the finite state machine defined by Table 1.
~
e
0 1 0 1
So So S1 0 0
S1 So S1 1 1
Table 1
(b) Determine the output for the following sequences, assuming s0 is the initial state
(i) x =1 1 1
(ii) x = 10 10
(iii) x = 0 0 0 1 1
END OF PAPER