大O时间复杂度会是多少?我主要是对while循环的运行时间感到困惑。我知道两个for循环的运行时间都是O(n)。
cin >> n >> min >> max;
for(int i = min; i < n; i++) {
for(int j = 1; j < max; j++) {
total = 1;
while(total < n) {
total = total *2;
}
}
}
O(n)
?在我看来,它看起来像是O(max)
。 - ajb