19CSC202A Assignment-2
19CSC202A Assignment-2
Course Assessment
Reg. No. Name of the Student
Marks
Max Marks
Sections
Marking Scheme
Scored
Marks
CO
Definition 1 1
Part-A
Hasse diagram 2 4
3.2
Topological sort to find the compatible total ordering 3 6
Total Assignment Marks 25
Page 1 of 3
Assignment
Instructions to students:
1. The assignment consists of 3 parts
2. The assignment has to be neatly word processed as per the prescribed format
3. The maximum number of pages should be restricted to 20
4. Use only SI units
5. Submission Date: 16/01/2021
6. Submission after the due date is not permitted
7. Method of evaluation as per the submission and marking scheme
8. At the end, you are required to comment on -
a. Benefits you have derived by solving this assignment
b. Whether assignment was able to assess module learning outcomes or not?
9. IMPORTANT: It is essential that all the sources used in preparation of the assignment must be
suitably referenced in the text.
Part – A (5 Marks)
1.1 Define 𝑛 −ary relation. Your report on 𝑛 −ary relations should contain the following:
1.1.1 Discuss how these relations are used to represent computer databases with
an example.
1.1.2 Illustrate how SQL commands are related to operations − selection,
projection, and join on 𝑛 −ary relations with an example.
2.2 Let 𝑝 be a prime, suppose that we have 𝑝 − carriages and 𝑛 − different colours
2.1.1 In how many ways can we paint a train with 𝑝 − carriages, if we can paint
each carriage in one of 𝑛 colours.
2.1.2 In how many ways can we paint a merry-go-round with 𝑝 − carriages, if we can
paint each carriage in one of 𝑛 colours.
Page 2 of 3
3.1.1 Determine the reflexive and the symmetric closure of 𝑅.
3.1.2 Utilize Warshall’s algorithm to find the transitive closure of 𝑅.
3.1.3 Write a MATLAB function for Warshall’s algorithm, hence find the matrix
representing transitive closure of 𝑅.
3.2 Let {𝑎, 𝑏, 𝑐, 𝑑, 𝑒, 𝑓, 𝑔, ℎ, 𝑖} be the tasks to be carried out for the completion of a project at a
computer company. A partial ordering on tasks is set up below by considering task 𝑥 ≺ task
𝑦 if task 𝑦 cannot be started until task 𝑥 has been completed.
{(𝑎, 𝑐), (𝑎, 𝑓), (𝑎, ℎ), (𝑎, 𝑖), (𝑎, 𝑔), (𝑎, 𝑑), (𝑏, 𝑓), (𝑏, ℎ), (𝑏, 𝑖), (𝑐, 𝑓), (𝑐, ℎ), (𝑐, 𝑖),
(𝑑, 𝑔), (𝑑, 𝑖), (𝑑, ℎ), (𝑒, 𝑔), (𝑒, 𝑖), (𝑒, ℎ), (𝑓, ℎ), (𝑓, 𝑖), (𝑔, ℎ), (𝑔, 𝑖)}
3.2.1 Draw the Hasse diagram for the tasks, with respect to the given partial
ordering.
3.2.2 Make use of topological sorting algorithm to find the order in which these
tasks can be carried out to complete the project.
Page 3 of 3