Question: Question 5 . ( a ) Suppose R is relation on set X where | X | = n . Briefly explain how we can

Question 5.
(a) Suppose R is relation on set X where |X|=n. Briefly explain
how we can associate an adjacency matrix M_(R) of size n x n to R.
(2 marks)
(b) Write pseudocode for an algorithm that, given an adjacency matrix M_(R) of a relation R, returns '1' if R is symmetric and reflexive; and returns '0' otherwise. Analyze the time complexity of your algorithm for the best and worst cases.
(c) Given an adjacency matrix M_(R) of a relation R, write pseudocode for an algorithm that checks whether R is transitive. Discuss the correctness of your code and analyze the times complexity of your algorithm.
(d) Write pseudocode that computes after M^(2):=M_(R)xxM_(R) execute
False if M^(2)[i][j]=1 but M_(R)[i][j]=0 for some i and j; otherwise
returns True. Analyze the times complexity of your algorithm.
(e) Compare your the complexity of your algorithms in (c) and (d). If we use Strassen algorithm for matrix multiplication, how would it impact the time complexity of (d)?
(f) Based on your answers for the above items and assuming Strassen'
algorithm for matrix multiplication, write pseudocode that, given
an adjacency matrix M_(R) return 1 if R is an equivalence relation
and 0 otherwise. Analyze the time complexity of your algorithm
for the best and worst cases.
(g) Use your code to execute all the equivalence relations on a set of size 4. Print or draw all the equivalence relations on a set of size 4
Question 5 . ( a ) Suppose R is relation on set X

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!