Computing – Big O Complexity when iterating in 3 dimensions

The first thing you should study in detail about the asymptotic analysis and the amortized analysis.

If we consider the asymptotic analysis for its scenario with bx = 10, for = 1000, bz = 1000 as your friend suggested if you consider an input set by Y bz then relatively bx It has a small value that can be considered constant. However, in your case, all these values ​​are constant and their execution time can be considered as constant. O (1).

When calculating the asymptotic upper limit of Big-O & # 39; O & # 39 ;, we ignore the constants.

However, if you only use values ​​such as:
bx = 1000000000, for = 100000000000, bz = 100000000000
where the input size of bx Also relatively higher, therefore, by definition of big-o

That is, f (x) = O (g (x)) if and only if there is a positive real number c and a real number x & # 39; such that
f (x) <= c g(x) for all x > X & # 39;

can indicate the complexity for O (bx * by * bz).

To summarize in the first case you used the same value. north to calculate all the loops, but in another case, it used three different input sizes, so its complexity will always be O (bx * by * bz) and if any or more value of bx, by or bz it's constant so you can skip it