Is O(Kn) Linear Complexity or Quadratic Complexity? or Does It Depend on the K?
If N Is Very Big, and K Is Very Small, Can I Say That O(Kn) Is Linear Complexity? What If K Is Closed to N/2, but Not More Than N/2? Do I Consider It Still as...
If n is very big, and k is very small, can I say that O(kn) is linear complexity?
What if k is closed to n/2, but not more than n/2? Do I consider it still as linear complexity? Or quadratic complexity O(n^2)?
Is there a limit to how big k is, to consider O(kn) as quadratic complexity?
2 Answers
If k is a constant, then any O(kn) function is O(n), i.e. linear
If k is a function of n and is O(n), then any O(kn) function is O(n^2). n/2 is O(n). Furthermore, (n^2)/2 is not O(n), and so if k is close to n/2 then kn is not O(n).
If k is not O(n), then kn is not O(n^2).
Assuming that k and n are independent variables, saying O(kn) is linear is a proper statement.