有助于找到时间的复杂性和 space 的复杂性

A little help finding the complexity of time and and complexity of space

int f2(int n)
{    
    int x, y, z = 0, i;

    for(x = n, i = 0; i < n; i ++, x *= n)
    {
        y = x;
        while (y > 1)
        { 
            y /= 3;
            z += y;
        }
    }
return z;
}

我对第一个循环感到困惑,我的问题是我无法弄清楚循环执行了多少次以及x如何影响 一般的代码。

是:

log3(n) + log3(n2) + .. . + log3(nn) = log3(n)n(n+1) /2

短期内:

n^2log(n)