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
Saying that function f(n) is O(g(n)) means that there exists some constant q such that for all values of n which are no less than one, f(n) will be no greater than q g(n).
Conversely, saying that function f(x,y) is O(g(x,y)) means that there exists some constant q such that for all values of x and y which are no less than one, f(x,y) will be no greater than q g(x,y).
If k is a constant, then both values above are equivalent to O(n) since for any value of k, and for any n which is no less than one, if one sets q equal to (k+1), then neither nk nor n+k will exceed qn [i.e. (k+1)n] for any value of n which is no less than one.
If k and n are both fully-independent variables, then O(nk) is irreducible; O(n+k) will be O(max(n,k)), since if one sets q equal to 2, q(max(n,k)) [i.e. 2max(n,k)] will be greater than or equal to n+k for all values of n and k which are no less than one.