I'm new to calculating complexity so this is confusing me. If my code get an unknown length (n) array of integers, suppose that the array (arr) is sorted already and I want for loop like this:
for (int k=0; k<arr[n-1]; k++);
Does this code complexity is O(1) or O(n)?
I'm used to calculate complexity depend on itaration as function of length but here it depend on the data inside the array.
arr[n - 1]?