f(n)={1when n is odd2when n is eveng(n)={2when n is odd1when n is even
2.4
a)
Since i>2j−1i1≤2j−11
There are in total 2j−(2j−1+1)+1=2j−1 terms
so the sum of the terms must be less or equal than 2j−12j−1=1
Thus Sj≤1 is proved.
b)
Since i≤2j−1i1≥2j1
There are in total 2j−(2j−1+1)+1=2j−1 terms
so the sum of the terms must be greater or equal than 2j2j−1=21
Thus Sj≥21 is proved.
c)
∑i=12ki1=1+∑j=1kSj
We know from (a) that Sj≤1 so
1+∑j=1kSj≤1+k⋅1=k+1
We know from (b) that Sj≥21 so
1+∑j=1kSj≥1+k⋅21=22+k>2k+1
a)
we first show that
ln(n!)≤nlnn⟺eln(n!)≤enlnn⟺n!≤(elnn)n=nn
Using the Definition 1 of O-notation:
We set f(n)=ln(n!),g(n)=nlnn,C=1,N=1. Then
ln(n!)≤C⋅nlnn∀n≥N
Thus the statement is proved
Another approachln(n!)=ln(1⋅2⋅⋯⋅n)=∑i=1nln(i)≤∑i=1nln(n)=nlnn
b)
(2n)2n≤n!⟺ln((2n)n/2)≤ln(n!)⟺2nln(2n)≤ln(n!)⟺2nlnn−2n⋅ln2≤ln(n!)
so we know 2nlnn−2n⋅ln2≤O(ln(n!))
Hence 2nlnn≤O(ln(n!)) using Theorem 2 with the fact that n<O(ln(n!))
And using theorem 2 again we know nlnn<O(ln(n!))