如何找到此 for 循环代码行的 Big O 表示法
for (int j = 0; pow(j,2) < n; j++) ?
有人知道吗?
我读过一些关于大 O 表示法的内容,它\xe2\x80\x99 是一个非常难以理解的主题。我知道通常像这样的 for 循环 \xe2\x86\x92 for (int n = 0; n < 20; ++n),有一个大 O 表示法O(1),随着输入增加 13,其输出也增加 13,具有线性复杂度。是不是和上面的情况一样呢?
for (int n = 0; n < 20; ++n)
algorithm big-o for-loop notation
algorithm ×1
big-o ×1
for-loop ×1
notation ×1