🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Closures and Warshall's Algorithm: all 10 questions

Quiz: Closures and Warshall's Algorithm · Question 10 of 10

How many powers of R can you need at most to get the transitive closure on a set of n elements?

How many powers of R can you need at most to get the transitive closure on a set of n elements?

  1. A.n²
  2. B.n
  3. C.2ⁿ
  4. D.It can need infinitely many
Answer & explanation

Correct answer: n

Any path longer than n steps repeats an element, and the loop can be cut out, so R ∪ R² ∪ … ∪ Rⁿ is enough.

Can you get the rest right without peeking?

Take the timed Quiz: Closures and Warshall's Algorithm quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →