🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Solving Recurrences: all 15 questions

Quiz: Solving Recurrences · Question 8 of 15

Unrolling T(n) = T(n − 1) + n with T(1) = 1 gives:

Unrolling T(n) = T(n − 1) + n with T(1) = 1 gives:

  1. A.n log n
  2. B.2ⁿ − 1
  3. C.n²
  4. D.n(n + 1)/2
Answer & explanation

Correct answer: n(n + 1)/2

T(n) = 1 + 2 + … + n, which is n(n + 1)/2, or Θ(n²).

Can you get the rest right without peeking?

Take the timed Quiz: Solving Recurrences quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →