Question 26Asked in BEL PE Computer Science, 20 Dec 2025 (5:00 PM)

Consider the following pseudo-code: Algorithm TestComplexity(A[1..n])

Consider the following pseudo-code: Algorithm TestComplexity(A[1..n]) 1. sum ← 0 2. for i ← 1 to n do 3. for j ← 1 to i do 4. for k ← 1 to j do 5. sum ← sum + 1 6. return sum What is the asymptotic time complexity of the above algorithm?
  1. AO(n⁴)
  2. BO(n³)
  3. CO(n log n)
  4. DO(n²)
Show answerHide answer

Correct answer: (B) O(n³)

From BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM)

This is question 26 of BEL PE Computer Science PYQ, 20 Dec 2025 (5:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.