I have a trouble in understanding time complexity. People can look at algorithms and directly say what its time complexity is, but I can't do that well.
Consider two n * n
matrices (A
and B
). Their multiplication result is C
.
So, value of C11
consists of n multiplications and n-1 additions. How come that its time complexity is O(n^3)
? I would say O(n^2)
.
Can someone explain it in understandable language? I know what's theta , I know what is big O, but I just can't implement this stuff.
And if you provide another simple example similar to above, that would be greatly appreciated.