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 

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 Expert Approved Answer
Step: 1 Unlock

1 b Onlgn 2 b On2 Explanation 1 When i 1 the inner j loop r... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!