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

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)=

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp