Help me find the error in analysis of the following algorithm that I came up with to search an element in a unsorted arrar in O(logN)

#include<bits/stdc++.h>

using namespace std;

int count(int *a,int st,int end,int element)// return the index of the eleme

{

if(end==st)

```
{
if(a[end]==element)
{
return end;
}
else
{
return -1;
}
}
int mid=(st+end)/2;
int j=count(a,st,mid,element);
if(j!=-1)
{
return j;
}
int k=count(a,mid+1,end,element);
if(k!=-1)
{
return k;
}
return -1;
```

}

int main()

{

int size;

cin>>size;

int a[size];

int i=0;

while(i<size)

```
{
```

cin>>a[i];

++i;

}

int index=count(a,0,size-1,size);

cout<<index<<endl;

return 0;

}