Answer the question
In order to leave comments, you need to log in
How to determine the complexity of an algorithm?
How to correctly calculate the complexity of an algorithm? What is the complexity of the algorithm in O notation for matrix addition/multiplication? Is there any formula or method for calculating?
Answer the question
In order to leave comments, you need to log in
What is the complexity of the algorithm in O notation for matrix addition/multiplication?
Is there any formula or method for calculating?elementary: count the number (for O-notation - the maximum) of elementary operations required to calculate the algorithm for input data of dimension n. You shorten the constant.
Complexity can be translated into man-hours for implementation.
For example:
- I implemented the algorithm in 10 hours. It was complicated.
- and I implemented the same algorithm in 2 hours. It wasn't difficult.
In itself, the concept of "complexity" is subjective and depends on many factors:
- experience in implementing similar tasks;
- availability of specific knowledge;
- development environment;
- well-being, etc.
Let's start with what the Landau (not the German Edmund Landau) symbols O(f(n)) and o(f(n)) are as n→∞.
g(n) = O(f(n)), if ng(n)≤cf(n) is sufficient.
g(n) = O(f(n)), if g(n)/f(n) → 0 as n→∞ tends.
Thus…
• Landau symbols reflect the change of something (time, memory, etc.) at n→∞.
• If, for example, there are two cycles in each other and each for n, we write O(n²). For example, to multiply n×n matrices:
для i = 1…n
для j = 1…n
s = 0
для k = 1…n
s += a[i,k]·b[k,j]
c[i,j] = s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question