0% found this document useful (0 votes)
34 views6 pages

.Trashed-1699212035-Final MST 22-23 Solution

The document contains a mid-semester examination for a Discrete Mathematical Structures course. It consists of 5 questions assessing various concepts related to functions, relations, graphs, hashing, and discrete mathematics. The questions include proving properties of functions, analyzing species evolution patterns, illustrating different hashing techniques, finding transitive closures of relations using Warshall's algorithm, working with equivalence relations, and maximizing/minimizing values based on set constraints.

Uploaded by

Himanshu Kansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

.Trashed-1699212035-Final MST 22-23 Solution

The document contains a mid-semester examination for a Discrete Mathematical Structures course. It consists of 5 questions assessing various concepts related to functions, relations, graphs, hashing, and discrete mathematics. The questions include proving properties of functions, analyzing species evolution patterns, illustrating different hashing techniques, finding transitive closures of relations using Warshall's algorithm, working with equivalence relations, and maximizing/minimizing values based on set constraints.

Uploaded by

Himanshu Kansal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Roll Number:__________________________

Thapar Institute of Engineering & Technology, Patiala


Department of Computer Science and Engineering
MID SEMESTER EXAMINATION
B. E. (2nd Year): Semester-III (2022/23) Course Code: UCS405
(COE, CSE, EME) Course Name: Discrete Mathematical Structures
Date: September 24, 2022 Time: 5:30 PM – 7:30 PM Duration: 2 Hours, M. Marks: 30
Name of Faculty: Dr. Karamjeet Singh, Dr. Mamta, Dr. Rohan Sharma, Dr. Yashwant Singh Patel,
Dr. Shruti Aggarwal, Dr. Rakesh Kumar Yadav
Note: Attempt all questions in a proper sequence with justification.
Assume missing data, if any, suitably.

Q1(a) Show that if f and g are real-valued functions such that f(x) is O(g(x)), then for every positive integer (2)
n, f n(x) is O(gn(x)). [Note that f n(x) = f(x)n].

Solution: Because f (x) is O(g(x)), there are constants C and k such that
|f (x)| ≤ C|g(x)| for x > k.
Hence, |f n(x)| ≤ Cn|gn(x)| for x > k, so f n(x) is O(gn(x)) by taking the constant to be Cn.

Marking Scheme:
If the answer is partially correct and no valid explanation: 0.5
If the answer is correct and no valid explanation: 1
If a valid justification is given with answer 1.5-2 (depending upon the explanation)

Q1(b) An unusual species inhabits the forest surrounding Functional City. Each member of the species can
take one of three possible forms, called Schemander, Haskeleon, and Camlizard. (4)
In January of every year, each individual undergoes “evolution”—a process by which the individual
splits into two individuals, whose forms depend on the form of the original:
• A Schemander splits into a Schemander and a Haskeleon.
• A Haskeleon splits into a Schemander and a Camlizard.
• A Camlizard splits into a Schemander and a Haskeleon.
It is known that in June of year 0, the population consisted of a single Schemander. Assume that no
individual ever dies and that all individuals successfully undergo evolution exactly once. Let Sn, Hn,
and Cn be the number of Schemanders, Haskeleons, and Camlizards, respectively, in June of year n.
i. Express Sn, Hn, and Cn in terms of Sn-1, Hn-1, and Cn-1, for n > 0.
ii. Let Tn = Sn + Hn + Cn be the total number of individuals in June of year n. Show that
Hn = Tn-1 - Hn-1, for n > 0.
Note: Sn, Hn, and Cn are also denoted as 𝑺(𝒏), 𝑯(𝒏)𝒂𝒏𝒅 𝑪(𝒏).

Part i)

Part ii)

1/2
Marking Scheme: 2 marks for each part (i and ii),
If the answer is partially correct and no valid explanation: 0.5
If the answer is correct and no valid explanation: 1
If a valid justification is given with answer 1.5-2 (depending upon the explanation)

Q2 Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, and 59 into a hash table of length m = 11 (6)
using open addressing with the primary hash function h'(k) = k mod m. Illustrate the result of
inserting these keys using linear probing, using quadratic probing with c1 = 1 and c2 = 3, and using
double hashing with h2(k) = 1 + (k mod (m - 1)).

Solution:

Marking Scheme:
[Total 6 marks] 2 marks for each hashing approach
2 marks: Everything is correct
1.5 marks: Minor calculation mistakes
1 mark: Logically correct but calculation mistakes

Q3 Use Warshall’s algorithm to find the transitive closure of the relation defined on set A = {a, b, c, d, e} (6)
as shown in Fig.1. Clearly explain each step of the algorithm.

2/2
a

b c

d e

Fig. 1
Solution:

Marking Scheme:
1 Marks for each correct matrix (W1 to W5 5 Marks)
If the final transitive closure is written – 1 Marks
Marks will be deducted from 1 if the matrices contain wrong entries
Q4(a) Suppose that there are four friends whose names are Daenerys (D), Cersei (C), Arya (A) and Sansa (S). (3)
On the occasion of Diwali, few members are sending an e-mail to either of friends or herself. Hence, a
relation is being derived with respect to the mails sent in this process and this relation is R={(D,C),
(D,S), (A,A), (S,D)}. Nahor is assigned the task to find a smallest relation containing R such that the
3/2
new relation would be
i. Reflexive and Transitive
ii. Symmetric and Transitive
iii. Reflexive, Symmetric and Transitive
Note that you have to make distinct relations for i - iii.

Solution and Marking Scheme:


1-D, 2-C, 3-A and 4-S
Each part is of 1 mark. If a student has replaced D,C,A,S with 1,2,3,4. Full marks will be given
only if the student has written the prior assumption of converting alphabets to numbers.
THE ANSWER IS GIVEN IN ALPHABETS AS WELL AS CHARACTERS.
(a) {(1, 1), (1, 2), (1, 4), (2, 2), (3, 3), (4, 1), (4, 2), (4, 4)}
{(D,D), (D,C), (D,S), (C,C), (A,A), (S,D), (S,C), (S,S)}
(b) {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (2, 4), (3, 3), (4, 1), (4, 2), (4, 4)}
{(D,D), (D,C), (D,S),(C,D),(C,C),(C,S), (A,A), (4, 1), (4, 2), (4, 4)}
(c) {(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (2, 4), (3, 3), (4, 1), (4, 2), (4, 4)}
{(D,D), (D,C), (D,S),(C,D),(C,C),(C,S), (A,A), (4, 1), (4, 2), (4, 4)}

Q4(b) Let ℤ be the set of integers and ℤ∗ = ℤ − {0}. Let R be the following relation defined on ℤ × (3)
ℤ∗ : (𝑎, 𝑏)𝑅(𝑐, 𝑑) if 𝑎𝑑 = 𝑏𝑐. Prove that R is an equivalence relation.

Solution:

Marking Scheme:

Q5(a) Out of 60 students in a class, anyone who has chosen to study maths elects to do physics as well. But (3)
no one does maths and chemistry, 16 do physics and chemistry. All the students do at least one of the
three subjects and the number of people who do exactly one of the three is more than the number
who do more than one of the three. What are the maximum and minimum number of people who
could have done Chemistry only?

Solution: 44 and 0
Maths is a subset of Physics.

4/2
No one does maths and chemistry, 16 do physics and chemistry.

Number outside is 0 as all the students do at least one of the three subjects

a + b + c +16 = 60, or a + b + c = 44 (0.5)


The number of people who do exactly one of the three is more than the number who do more than
one of the three. =>
a + b > c + 16 (0.5)
So, we have a + b + c = 44 and a + b > c + 16
We need to find the maximum and minimum possible values of b.
Let us start with the minimum. Let b = 0, a + c = 44. a > c + 16. We could have
a = 40, c = 4. So, b can be 0.
Now, thinking about the maximum value. b = 44, a = c = 0 also works.

So, minimum value = 0, maximum value = 44. (2)


Marking Scheme:

Q5(b) Let R = {(a, b), (b, c), (c, a)} be a relation defined on set A = {a, b, c}. Find the symmetric closure of R 2 (3)
using Matrix representation.

Solution:

5/2
Symmetric Closure:

0 1 1
[1 0 1]
1 1 0
Marking Scheme:

0.5 for making initial matrix, 𝑀𝑅


1.5 for computing 𝑀𝑅2
1 for finding symmetric closure and writing resultant relation

6/2

You might also like