时间复杂度题解
function recursive(n) {
if (n <= 0) {
console.log('finish');
} else {
n-=2;
recursive(n);
recursive(n);
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
function foo(n){
var i = 1;
while(i <= n){
i = i * 2;
}
}
1
2
3
4
5
6
2
3
4
5
6