int result = 0;
int i = 0;
while (i < n / 2){
result += arr[i];
i += 1;
while (i >= n / 2 && i < n){
result += arr[i];
i += 1;
}
}
printf("%d\n", result);
It seems like will be executed O(n) times because the second loop will not be executed until the first loop is executed 1/2*n times. But I can also say the first loop execute O(n) times and second one execute O(n)times so it's O(n^2). Im so confuse now, which one is correct?