代码:
int c = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
c = i * j;
}
}
时间复杂度: O(n 2 )
现在以下代码的复杂性是什么:
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
//c = i * j;
// nothing is happening inside the loop
}
}
复杂性是否与上述相同( O(n 2 ) )或其他?