public static void complexityexample(int n) {
int count = 0;
int k = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
count++;
}
k *= 2;
for (int t = 0; t < n; t++) {
count++;
}
System.out.println(count);
}
}
Run Code Online (Sandbox Code Playgroud)
有人能给我答案吗?
例如,我知道for循环中的nuber操作是2N + 2,
和count ++中的操作数; 是N.
但是对于其他部分呢.