Design and Analysis of Algorithms - Old Questions

Question Answer Details

3.  Make a tight big-O analysis of following code.

void main()

{

   int m, n, i, j, a[], b[], c[];

   printf(“Enter value of m and n”);

   scanf(“%d%d”,&m,&n);

   for(i=0;i<n;i++)

   {

      a[i]=i;

      b[i]=i*i;

      c[i]=-i;

   }

   for(j=0;j<m;j++)

   {

      printf(“%d\\t%d\\t%d\\n”,a(j), b(j), c(j);

   }

}                                                                                                                                   [8]

 

8 marks
Asked in 2067

Answer

AI Generated Answer

AI is thinking...