In big O notation of time complexity in algorithmic analysis, when an algorithm depends on n and k, what is the difference between these two notations. Also pls help in the
O(nk) means the time it takes is proportional to n * k
. O(n+k) means the time it takes is proportional to n + k
. It's exactly what it seems like. You will need to be more specific in your question about what you don't understand.
In your case, the algorithm's runtime is O(nk) because the inner loop runs a total of n * k
times.