Skip to content

ISRO Scientist/Engineer CSE 2018Discrete Mathematics › Set Theory and Algebra

ISRO Scientist/Engineer CSE 2018 PYQ: The time complexity of computing the transitive closure of binary relation on a set of $n$ elements is known…

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

  1. A
    $O(n)$
  2. B
    $O(n*\log(n))$
  3. C
    $O(n^{\frac{3}{2}})$
  4. D
    $O(n^{3})$
    Correct answer

Answer

(D) $O(n^{3})$

Approach

The transitive closure of a binary relation on an $n$-element set can be computed by treating the relation as a directed graph and finding reachability between all pairs of vertices. The standard efficient method is Warshall's algorithm (equivalently Floyd–Warshall for reachability), which runs in $O(n^3)$ time. The attached graph is illustrative of a relation whose transitive closure would be computed by such an algorithm.

Reviewed by ISRO IQ Editorial Team.