我更喜欢尽可能少的正式定义和简单的数学.
algorithm complexity-theory big-o computer-science time-complexity
我需要计算以下代码的时间复杂度:
for (i = 1; i <= n; i++) { for(j = 1; j <= i; j++) { // Some code } }
是O(n ^ 2)?
complexity-theory big-o time-complexity
big-o ×2
complexity-theory ×2
time-complexity ×2
algorithm ×1
computer-science ×1