Somebody please tell time complexity of this


#1

searchMatrix(vector<vector > &v, int x) {
int n=v.size();
int m=v[0].size();
int mid=n/2;
if(x<=v[mid][m-1]){
for(int i=0;i<=n/2;i++){
for(int j=0;j<m;j++){
if(v[i][j]==x)return 1;
}
}
}
else if(x>=v[mid][m-1]){
for(int i=n/2;i<n;i++){
for(int j=0;j<m;j++){
if(v[i][j]==x)return 1;
}
}
}
return 0;
}


#2

Time complexity is O(m*n)