void compute(int n) {
int h = n;
while (h > 1) {
for (int i = 0; i < n; i++) {
// do some operation
}
h = h / 2;
}
}
Can anybody please tell me what is the complexity( Big O ) of this function of n ??
This is actually an argument between me and a friend of mine. my stand: complexity is O(n*log(n)) friend's stand: log(n)
Thanks for your responses.