The set o(1)
is not empty.
It is first important to remember that f(x)
is in o(g(x))
if and only if
lim_x->infinity { f(x) / g(x)} = 0
For non zero g(x)
But, more important, what is the set of candidate f(x)
?
Some define it over all real functions [1], i.e. f:R->RU{U}
(Where U is undefined for some values of the functions). This means, we can use any real to real function, including the function f(x)=1/x
.
We can also see that g(x)=1
is a non zero function, and indeed:
lim_x->infinity { 1/x / 1} = 0
This means, o(1)
includes the function f(x)=1/x
, and we can conclude the set is none empty.
Knuth also refers the function g(n) = n^-1
as a valid function, and uses O(n^-1)
in his explanation of big O,Omega and Theta (1976)
Others, Cormen is one of them, define the set as f:N->N, where N={0,1,...}, and this also includes f(x)=0
, which again holds the condition for being o(1).[2]
There is no algorithm with complexity function T(n)
in o(1)
While little o notation is defined over reals, our complexity functions for algorithms are not. They are defined over natural numbers [3]. You either do the instruction, or don't. You cannot do half of an instruction, or e-1 instruction. This means, the set of complexity functions are f:N->N
. Since there is no such thing as "empty program" that has no instructions (recall that the overhead of calling it itself takes time), it even narrows this range to f:N->N\{0}
.
In other words, for any complexity function of an algorithm T(n)
, and for all n>0
, T(n)>0
.
We can now go back to our formula:
lim_x->infinity { T(x) / 1} >= lim_x->infinity { 1 / 1} = 1 > 0
This shows us there is no positive natural function in o(1)
, and we can conclude no algorithm has a complexity function that is in o(1)
.
Foot Notes:
(1) If you are unsure about it, recall in Taylor series, at some point we stop adding the infinite series, and just mention it is O(x^n)
. The function we "hide" in this big O notation is not over the natural numbers.
(2)If we however define the set N+={1,2,...} to be the set of positive natural numbers, and o(g(n)) to be a subset of positive natural functions, o(1) is an empty set, with a proof identical to the one showing no algorithm has this complexity.
(3) Well, for average cases, the image can be a non natural number, but we'll assume worst case complexity here, though the claim can still hold for average case, since there is no empty program.