CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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

A
O(n)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
O(nlogn)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
O(n3/2)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
O(n3)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D O(n3)
The time complexity of computing the transitive closure of a binary relation on a set of n elements is O(n3). Apply the Warshall's algorithm to compute the transitive closure. The algorithm contains three nested for loops each having frequency n so time complexity is O(n3).

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
QUANTITATIVE APTITUDE
Watch in App
Join BYJU'S Learning Program
CrossIcon