Question: 1 . What is the complexity of the given method as a function of the problem size n ? Show all details of your analysis.

1.What is the complexity of the given method as a function of the problem size n? Show all
details of your analysis.
public static int count (int n)
{
if (n%2==0)
return n;
int i=0;
while (i >0)
i--;
return i;
}
2. Write a pseudocode to print first n Fibonacci numbers. Analyze the time complexity of
your algorithm.
3. Evaluate the time complexity of searching for an element in a linked list.

Step by Step Solution

There are 3 Steps involved in it

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