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)=
Hi there! Click one of our representatives below and we will get back to you as soon as possible.