I am trying to understand how to compute the time complexity of an algorithm .
I have this piece of code: This is the whole method:
public void solve(int i) {
if(i < 2) {
return;
}
solve(i-1); //recursive call
int x = v[n-i];
for(int j = n-i+1; j < n; j++) {
if(x > v[j]) {
count++;
}
}
return;
}
I think the complexity is O(n). Am I right?
Thanks