小编Tho*_*s B的帖子

O(n)运行时算法

O(n)根据我们的教授,下面的算法有运行时间,但是我很困惑为什么它不是 O(n log(n)),因为外部循环可以运行log(n)多次,内部循环可以运行多达n几次.

Algoritme Loop5(n) 
i = 1 
while i ? n 
    j = 1 
    while j ? i 
       j = j + 1 
    i = i?2
Run Code Online (Sandbox Code Playgroud)

algorithm performance big-o notation

5
推荐指数
1
解决办法
222
查看次数

标签 统计

algorithm ×1

big-o ×1

notation ×1

performance ×1