0

```
int find(int x)
{
for(int i=0;i < n; i++)
{
if(a[i]==x)
return i;
}
return -1;
}
int find(int x)
{
for(int i=0;i < n/2; i+=2)
{
if(a[i]==x)
return i;
if(i+1 < n && a[i+1]==x)
return i+1;
}
return -1;
}
int find(int x)
{
for(int i=0;i < n/3; i+=3)
{
if(a[i]==x)
return i;
if(i+1 < n && a[i+1]==x)return i+1;
if(i+2<n && a[i+2]==x)return i+2;
}
return -1;
}
```

Which is faster and why? Also, what if I increase the k in n/k in the loop ? Will it make it more faster or slower? What is concept behind this? Thanks in advance.

*Edited 1 Year Ago by nitin1*