✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
A complexidade temporal no pior caso do método algoritmoX é O( n ).
//
The worst-case time complexity of the method algoritmoX is O( n ).
public int algoritmoX(int[] vec){ int n = vec.length-1; return algoritmoXAux(vec, 0, n); } private int algoritmoXAux(int[] vec, int low, int high){ if (low>=high) return vec[high]; int mid = (low+high)/2; if (vec[mid] % 2 == 0) return algoritmoXAux(vec, low, mid); else return algoritmoXAux(vec, mid+1, high); }