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=1;i<=m;i++)
a[i]=i*i;
for(j=1;j<=n;j++)
b[j]=-j;
for(i=1;i<=m;i++)
printf(“%d”, a[i]);
for(j=1;j<=n;j++)
printf(“%d”, b[j]);
Answer
AI Generated Answer
AI is thinking...