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
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...