Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

1. a) What is the worst case and best case running time of the following algorithm?

1.    a) What is the worst case and best case running time of the following algorithm? [.5 marks]

b) Count the number of primitive operations line by line.  [.5 marks]

[Total = 1 mark]

for (i=1; i<=n; i++)                                             __time

{

     if (a[i] > 0)                                                    ___time

     {

                 for(j=0;j<n; j+2)                               ___time

                            c[i] = c[i]/b[i];                        ___time                      }

else

                 c[i] = b[i];                                          ___time                      

}

Best case T(n)=

Worst case T(n)=

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question