what is time complexity of this code?
I have tried solving this using binary search but it cannot be solved in that way please help to find the complexity of this code.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int x;
cin>>x;
int p=-1;
int q=n;
while(p+1<q)
{
int m=(p+q)/2;
if(a[m]<x)
p=m;
else
q=m;
}
cout<<"j";
}