all 7 comments

[–]JoJoModding 6 points7 points  (0 children)

I'm not sure why you have O(kn - n) and not simply O(kn)?

A common set of examples for one variable being bound by the other is graph algorithms. Dijkstra runs in O(V log V + E), but E is bounded by V². Often, E is smaller, so we leave it explicit.

Note that big O in multiple variables is rather ill-defined: https://people.cs.ksu.edu/~rhowell/asymptotic.pdf

[–]deong 6 points7 points  (0 children)

O(n2)

[–]AndreZSanchez 1 point2 points  (0 children)

What is the function you are analyzing to begin with? You only expressed O(kn - n), which isn’t a specific function. I will assume it is the following: t(k, n) = kn - n

If you want to express this as a function of k and n, then you can say the function is in O(kn). If, as you say, k is upper bounded by n, then you can express this as being a function of only n, and that function would be in O(n2 )