What does this mean: "Detected time complexity: O((N+M)*K)"?
I was trying one of the online developer certificating website's demo test. I have written it in C# using many interfaces, events etc.
My code passed but it compla开发者_JAVA百科ined that:
Detected time complexity: O((N+M)*K)
What does basically O((N+M)*K) mean?
And if I want to repair this complexity, (it is a code works on arrays) usually where is best to start checking?
Updates: The code works on multi-dimensional array and it has a loop within a loop (walks through rows and then columns at some point)
It would completely depend on what your code is supposed to do.
Big-Oh tells you what the main factors are that determine how long your algorithm will take.
This is an example of Big-O notation:
http://en.wikipedia.org/wiki/Big_O_notation
I don't know the specifics of the type that you've got, but what it's telling you is that the method in question but what it's telling you is that the bounds of the method are that it will run many times (n+m)*k.
How it's come to this conclusion is by examining the relationship of the internal loop of your method, to how many times its run in an outer loop.
the fact that it thinks '* k' is a factor means it's warning you that it could take a long time for large arrays.
Can you post the Method itself ?
精彩评论