算法的时间复杂度(伪代码)

时间:2019-04-21 16:58:14

标签: time complexity-theory

prod=1;
Nfour= sqrt(n) * sqrt(n);
    For k=1 to Nfour do
        If K mod sqrt(n)=0 then
            for j=1 to k do
                if j mod sqrt(n)=0 then
                    for m=1 to j do
                        prod=prod *4

如何计算此算法的时间复杂度?

1 个答案:

答案 0 :(得分:0)

通过查看上面的代码,我们有3个嵌套的for循环,嵌套时将花费n ^ 3的复杂度,而其余操作则需要固定的时间。

此资源可能会有所帮助-1- http://bigocheatsheet.com/                                  2- How to find time complexity of an algorithm

相关问题