The question is to find the common elements in two arrays .The code which i wrote have the complexity of order n square.
How it can be done in linear timeCode:void main ()
{ int i,j;
int a[]={1,2,3,4};
int b[]={4,5,7,1};
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
{ if (a[i]==b[j])
{
printf("%d",a[i]);
}
}
}
}