Question: The complexity for the following code is int fun (int n) for (int i = 1; i The complexity of the following code is
The complexity for the following code is int fun (int n) for (int i = 1; i The complexity of the following code is void f(int n) { if (n > 0) { DoSomething (n); // o (n) f (n-1); } } Select one: a. O(nlgn) b. O(n) c. O(gn) d. O(n)
Step by Step Solution
3.32 Rating (155 Votes )
There are 3 Steps involved in it
1 b Onlgn 2 b On2 Explanation 1 When i 1 the inner j loop r... View full answer
Get step-by-step solutions from verified subject matter experts
