About the worst-case time complexity question

Hi, everyone. Could anybody help me check whether my answer for this question is correct?

**The question is:**

Consider the following Java method definition:

Code:

`public static void f(int [] a, int l, int h, int k){`

int m = (l+h)/2;

if (l >= h){

return;

}else if (a[m] >= k){

System.out.println("left");

f(a,l,m,k);

}else{

System.out.println("right");

f(a,m+1,h,k);

}

}

What is the worst-case time complexity of the following call to f, expressed

in big-Oh notation:

f(a,0,a.length,5);

Briefly justify your answer.

**I think the answer is O(log(n))** because it is half the data size when recursively called.

Anyone can help me check whether the answer is correct? If not, could you help to give me some tips?

Thanks!