Open In App
Related Articles

GATE | GATE-CS-2005 | Question 7

Improve Article
Improve
Save Article
Save
Like Article
Like

The time complexity of computing the transitive closure of a binary relation on a set of n elements is known to be

(A)

O (n)

(B)

O (n log n)

(C)

O(n3/2)

(D)

O(n3)



Answer: (D)

Explanation:

Answer : (D)

Explanation:

The correct answer is (D), O(n3).

The transitive closure of a binary relation on a set of n elements can be computed using the Floyd–Warshall algorithm. This algorithm has a time complexity of O(n3).

The other options are incorrect. Option (A), O(n), is the time complexity of simply iterating over the set of n elements. Option (B), O(n log n), is the time complexity of sorting the set of n elements. Option (C), O(n3/2), is not a valid time complexity. https://www.geeksforgeeks.org/data-structures-and-algorithms-set-22/

See question 3 of

Quiz of this Question


Quiz of this Question
Please comment below if you find anything wrong in the above post

Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.

Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads