我明白 x 行是 O(n),但是 y + z 行应该是 O(1),不是吗?所以总运行时间为 O(n + 1) = O(n)。但正确答案是 O(n + n) = O(n)。这是为什么?
foo2(int n){
for(int i=1 to n) //line x
if(i==y^4){. //line y
for(j=1 to n) //line z
{ print "hi there" }
}//endif
print "hello";
}//endfor
}//foo()