3.1-1 Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic definition of Θ-notation, prove that max(f(n),g(n))=Θ(f(n)+g(n)).
Let f(n),g(n) be asymptotically nonnegative. Show that max(f(n),g(n)) = Θ(f(n)+g(n)). This means that there exists positive constants c1,c2 and n0 such that, 0<= c1(f(n)+g(n))<=max(f(n),g(n))<=c2(f(n)+g(n)), for all n>=n0.
Selecting c2=1 clearly shows the third inequality since the maximum must be smaller than the sum. c1 should be selected as 1/2 since the maximum is always greater than the weighted average of f(n) and g(n). Note tha significance of the "asymptotically nonnegative" assumption. The first inequality could be satisfied otherwise
3.1-2 Show that for any real constants a and b, where b>0,
To show that , we want to find constants c1,c2,n0>0 such that
Note that and
Thus,
Since b>0, the inequality still holds when all parts are raised to the power b:
Thus, satisfy the definition.
3.1-3 Explain why the statement, "The running time of algorithm A is at least," is meaningless.
Let the running time be T(n). means that
for some function f(n) in the set
, This statement holds for any running time T(n), since the function g(n)=0 for all n is in
,and running times are always nonnegative. Thus, the statement tells us nothing about the running time.
3.1-4 Is ? Is
?
,but
.
To show that, we must find constants c,
such that
.
Since for all n, we can satisfy the definition with c=2 and
To show that , assume there exist constants c,
such that
.
Then . But no constant is greater than all
, and so the assumption leads to contradiction.