

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(a) 3
n is O( 4
n + log(n))
Solution
No. (2 pts)
Proof (2 pts) Suppose that 3
n is O( 4
n+ log(n)). By the supposition that 3
n is O( 4
n+
log(n)), there exists a positive real number B and a real number b such that for all integers
n > b
| 3
n| ≤ B| 4
n + log(n)| (1)
Let n be a positive integer that is greater than max{(2B) 12 , 16 ,b}. Then
n > (2B) 12 =⇒ | 3
n| = 12
n 4
n > 2 B 4
n 4
n > log(n) for all integers n > 2 16 =⇒ 2 B 4
n > B( 4
n + log(n))
∴ | 3
n| > B( 4
n + log(n)) = B| 4
n + log(n)|.
Thus there is an integer n > max{(2B) 12 , 2 16 , b} ≥ b such that
3
n| > B|
4
n + log(n)|.
This contradicts (1). Hence the supposition is false, and so 3
n is not O( 4
n + log(n)).
(b) 100
n is O(log n)
Solution
No. (2 pts)
Proof (2 pts) Suppose that 100
n is O(log n). By the supposition that 100
n is O(log n),
there exists a positive real number B and a real number b such that for all integers n > b
100
n| ≤ B| log n| (2)
Let B ′ = max{B, 1 }. Let n be a positive integer that is greater than max{ 2 1000 B′ ,b}. Then
We have 100
n > B ′ log n ≥ B log n.
∴ | 100
n| > B| log n|.
Thus there is an integer n > max{( 1000 B′ , b} ≥ b such that
100
n| > B| log n|.
This contradicts (2). Hence the supposition is false, and so 100
n is not O(log n).
(c) log 3 n is O(log n)
Solution
No. (2 pts)
Proof (2 pts) Suppose that log
3 n is O(log n). By the supposition that log
3 n is O(log n),
there exists a positive real number B and a real number b such that for all integers n > b
| log
3 n| ≤ | log n| (3)
Let n be a positive integer that is greater than max{ 2 B
1 2 ,b}. Then
log 3 n = log 2 n log n > B log n.
∴ | log
3 n| > B| log n|.
Thus there is an integer n > b such that
| log
3 n| > B| log n|.
This contradicts (3). Hence the supposition is false, and so log 3 n is not O(log n).
(d) Let a, b be any positive integers.
(a + n) b isO(n a )
Solution
No. (2 pts)
Proof (2 pts) Let a = 1, b = 2. We show (1 + n) 2 is not O(n). This can be proved by
Theorem 9.2.2. Hence, (a + n) b isO(n a ) does not hold for all a, b that are positive integers.
(e) b
nc is O(
n).
Solution
Yes. (2 pts)
Proof (2 pts) For any integer n > 1, |b
nc| = b
nc because since n > 1 > 0, then
b
nc > 0
=⇒ |b
nc| ≤
n because |bxc| ≤ x for all real numbers x
=⇒ b
nc ≤
n because
n ≥ 0.
Let M = 1 and x 0 = 1. Then |b
nc| ≤ M |
n| for all integers n > x 0 , and so by definition
of O-notation, b
nc is O(
n).
is non-zero and we use capital Letter only.)
(a) (2.5 pts) How many different labels are there?
26 2 × 9 2 × 26 2
(b) (2.5 pts) How many different labels are there with distinct letters and digits?
26 ∗ 25 ∗ 9 ∗ 8 ∗ 24 ∗ 23
(c) (2.5 pts) How many different labels could begin with AB and have non-repeating letters
or digits?
9 ∗ 8 ∗ 24 ∗ 23
(d) (2.5 pts) How many different labels have the letters A and B and have non-repeating
letters or digits?
P (4, 2) ∗ 9 ∗ 8 ∗ 24 ∗ 23 [In the first step we find the positions for A and B (there are P (4, 2)
ways). Then we choose the remaining letters and digits.]
a line. How many are the different ways to form the line
(a) if A is neither the first nor the last (6th) one.
(b) A and B are either the first or the last (6th) one.