最近在看《算法导论》,看到多线程算法这章中,有一个parallel for循环的例子,如下:
parallel for i = 1 to n
parallel for j = 1 to n
cij = 0
for k = 1 to n
cij = cij +aik +bkj
书上说的时间复杂度为O(lgn)+O(lgn)+O(n)=O(n);也就是说一个parallel for 循环的复杂度是O(lgn),既然是并行循环,为什么不是O(1)呢?求大神指导
转载于:https://www.cnblogs.com/jintianya/p/3845417.html