使用if else语句的三个嵌套for循环的Big O表示法

时间:2019-05-26 07:05:16

标签: big-o

这是算法:

for j= 1 to m do   
 //assign values 
end for

for t = 1 to T do  
  for j = 1 to m do
      if t < T then
        for d = 1 to t do
          // perform some operation
        end for
      else
        for d = 1 to t do
          // Different operations
        end for  
  end for

 for j = 1 to m do  
  for i = 1 to m
     // doing some operations  
  end for 
 end for

 end for

我正在为上述循环计算Big O表示法。我的理解是,大的O表示法将是O(Tm(T + m))。有人可以阐明它的对与错吗?

0 个答案:

没有答案