Time Complexity

What is the time complexity of the code below?

1
2
3
4
5
6
int count = 0;
        for (int i = N; i > 0; i /= 2) {
            for (int j = 0; j < i; j++) {
                count += 1;
            }
        }

Assume that arithmetic operations take constant time regardless of the size of the input.

×

Problem Loading...

Note Loading...

Set Loading...