| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
About Exam
hard
Loop and Recursion Time Complexity
< Prev
Next >

What is the time complexity of the following combinedMethod method?

public void combinedMethod(int n) {
    if (n <= 1) return;
    for (int i = 0; i < n; i++) {
        System.out.println(i);
    }
    combinedMethod(n - 1);
}
A

O(n log n)

B

O(n^2)

C

O(n)

D

O(2^n)

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy