I need help to determine what the time complexity of a code segment.
I've tried to understand how to add everything up but I'm not sure it is correct. The first loop and second loop is to my understanding logarithmic and the last is linear, or atleast that is what I think. But I don't understand how to finalise the problem and provide a time complexity.
sum = 0; count = 0;
for (int i = 1; i < N; i = i*2){
sum = sum + 1;
for (int j = i; j < N*N; j = j*2){
count++;
}
for (int k = i; k < N; k++){
count--;
}
}
My guess is that it is: (logN * logN) + (logN * N) -> O(NlogN) But since the third loop is not nested in the second loop I'm not sure how to properly determine the complexity. So please help me.. :)