我更喜欢尽可能少的正式定义和简单的数学.
algorithm complexity-theory big-o computer-science time-complexity
我在这里几个问题考虑以下循环(让N = 8)
for(int i=1;i<N/2;i++){
// this is O(logN)
}
Run Code Online (Sandbox Code Playgroud)
N/2 = 4但是log(8)= 3(考虑基数为2)那么为什么上面的循环被认为是O(logN)
以及O(loglogN)循环如何?
PS:对不起我糟糕的数学概念
algorithm time-complexity asymptotic-complexity data-structures