没有合适的资源?快使用搜索试试~ 我知道了~
首页"离散数学及其应用(第8版)奇数题答案总结"
离散数学及其应用是一门关于离散结构、数理逻辑和集合论等领域的数学课程。它广泛应用于计算机科学、电子工程、通信工程和数学等学科。本书《离散数学及其应用》是Kenneth H. Rosen所著的第8版教材。
本书提供了大量的习题,包括奇数题和偶数题。本文主要总结了书中奇数题的答案,以帮助学生更好地学习和理解离散数学的概念和原理。
第一章是对离散数学基础知识的介绍。在第1.1节中,我们回答了一些关于命题逻辑的问题。例如,我们证明了命题"A或非A"永远是真的,并证明了命题"非A且非非A"永远是假的。这些问题旨在帮助学生理解命题逻辑的基本概念。
在第1.3节中,我们继续介绍了命题逻辑的推理法则。我们证明了一些常用的推理法则,如析取析取律、蕴含蕴含律和双条件双条件律。这些推理法则在离散数学和计算机科学中经常被使用,因此学生应该牢记它们。
第一个习题是关于逻辑运算的性质。在这个习题中,我们需要判断一些命题的真假。有些命题可以通过直接判断真值来解答,而有些命题需要使用逻辑运算的特性来判断。例如,对于命题“Linda比Sanjay年长”,我们可以通过直接比较他们的年龄来判断真假。而对于命题“Mei比Isabella赚的钱多”,我们需要使用否定运算来判断。
在第1.5节中,我们学习了集合论的基础知识。我们回答了一些关于集合交集、并集和差集的问题。例如,在习题5中,我们需要判断一些集合关系的真假。这些问题考察了学生对集合运算的理解和掌握程度。
在本章的最后一节中,我们学习了关系和函数的基本概念。我们回答了一些关于关系和函数性质的问题。例如,在习题7中,我们需要判断一些关系和函数的存在性。这些问题帮助学生巩固了关系和函数的定义和性质。
总的来说,本章的习题答案涵盖了离散数学中许多重要概念和原理。通过解答这些习题,学生可以更好地理解离散数学的核心思想和应用。希望这些答案对学生们的学习有所帮助,并激发他们对离散数学的兴趣和研究热情。
P1: 1
ANS Rosen-2311T MH03280-Rosen-v1.cls May 8, 2018 17:25
S-16 Answers to Odd-Numbered Exercises
67.
–2
–1
0
–1–2
1
231
3
2
–3
69. a)
3
2
1
–
2–4 2 4
–2
–3
–
1
b)
3
2
1
–2
–3
–1
–
212
–1
c)
3
2
1
–2
–3
–1
–6
–
12 –3–9 6 1239
d)
3
2
1
4
–2
–3
–
1
–1
1
e)
3
2
1
4
–2
–3
–4
–1
–
2–1 21
f)
3
2
1
4
5
–2 –1 1 2
–2
–3
–1
–4
g) See part (a). 71. f
−1
(y) = (y − 1)
1∕3
73. a) f
A∩B
(x) =
1 ↔ x ∈ A ∩ B ↔ x ∈ A and x ∈ B ↔ f
A
(x) = 1andf
B
(x) =
1 ↔ f
A
(x)f
B
(x) = 1 b) f
A∪B
(x) = 1 ↔ x ∈ A ∪ B ↔ x ∈ A or
x ∈ B ↔ f
A
(x) = 1orf
B
(x) = 1 ↔ f
A
(x) + f
B
(x) − f
A
(x)f
B
(x) = 1
c) f
A
(x) = 1 ↔ x ∈ A ↔ x ∉ A ↔ f
A
(x) = 0 ↔ 1 − f
A
(x) = 1
d) f
A⊕B
(x) = 1 ↔ x ∈ A ⊕ B ↔ (x ∈ A and x ∉ B)
or (x ∉ A and x ∈ B) ↔ f
A
(x) + f
B
(x) − 2f
A
(x)f
B
(x) = 1
75. a) True; because xis already an integer, x = x.
b) False; x =
1
2
is a counterexample. c) True; if x or y is an
integer, then by property 4b in Table 1, the difference is 0. If
neither x nor y is an integer, then x = n + 𝜖 and y = m + 𝛿,
where n and m are integers and 𝜖 and 𝛿 are positive real num-
bers less than 1. Then m + n < x + y < m + n + 2, so
x + yis either m + n + 1orm + n + 2. Therefore, the given
expression is either (n + 1) + (m + 1) − (m + n + 1) = 1or
(n + 1) + (m + 1) − (m + n + 2) = 0, as desired. d)
False;
x =
1
4
and y = 3 is a counterexample. e) False; x =
1
2
is
a counterexample. 77. a) If x is a positive integer, then the
two sides are equal. So suppose that x = n
2
+ m + 𝜖,where
n
2
is the largest perfect square less than x, m is a nonnegative
integer, and 0 <𝜖≤ 1. Then both
x and
x=
n
2
+ m
are between n and n + 1, so both sides equal n. b) If x is
a positive integer, then the two sides are equal. So suppose
that x = n
2
− m − 𝜖,wheren
2
is the smallest perfect square
greater than x, m is a nonnegative integer, and 𝜖 is a real num-
ber with 0 <𝜖≤ 1. Then both
x and
x =
n
2
− m
are between n − 1andn. Therefore, both sides of the equa-
tion equal n. 79. a) Domain is Z; codomain is R; domain of
definition is the set of nonzero integers; the set of values for
which f is undefined is {0}; not a total function. b) Domain is
Z; codomain is Z; domain of definition is Z;setofvaluesfor
which f is undefined is ∅; total function. c) Domain is Z × Z;
codomain is Q; domain of definition is Z × (Z −{0}); set of
values for which f is undefined is Z×{0}; not a total function.
d) Domain is Z × Z; codomain is Z; domain of definition is
Z×Z; set of values for which f is undefined is ∅; total function.
e) Domain is Z × Z; codomain is Z; domain of definitions is
{(m, n) ∣ m > n}; set of values for which f is undefined is
{
(m, n) ∣ m ≤ n}; not a total function. 81. a) By defini-
tion, to say that S has cardinality m is to say that S has exactly
m distinct elements. Therefore we can assign the first object
to 1, the second to 2, and so on. This provides the one-to-one
correspondence. b) By part (a), there is a bijection f from S to
{1, 2, … ,m} and a bijection g from T to {1, 2, … ,m}.Then
the composition g
−1
◦f is the desired bijection from S to T.
Section 2.4
1. a) 3 b) −1 c) 787 d) 2639 3. a) a
0
= 2,a
1
= 3,
a
2
= 5,a
3
= 9 b) a
0
= 1,a
1
= 4,a
2
= 27,a
3
= 256
c) a
0
= 0, a
1
= 0, a
2
= 1, a
3
= 1 d) a
0
= 0, a
1
= 1,
a
2
= 2,a
3
= 3 5. a) 2, 5, 8, 11, 14, 17, 20, 23, 26, 29
b) 1, 1, 1, 2, 2, 2, 3, 3, 3, 4 c) 1, 1, 3, 3, 5, 5, 7, 7, 9, 9
d) −1, −2, −2, 8, 88, 656, 4912, 40064, 362368,
3627776 e) 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536
f) 2, 4, 6, 10, 16
, 26, 42, 68, 110, 178 g) 1, 2, 2, 3, 3, 3, 3, 4,
4, 4 h) 3, 3, 5, 4, 4, 3, 5, 5, 4, 3 7. Each term could be
twice the previous term; the nth term could be obtained from
the previous term by adding n − 1; the terms could be the
positive integers that are not multiples of 3; there are in-
finitely many other possibilities. 9. a) 2, 12, 72, 432, 2592
b) 2, 4, 16, 256, 65, 536 c) 1, 2, 5, 11, 26 d) 1, 1, 6,
27, 204
e) 1, 2, 0, 1, 3 11. a) 6, 17, 49, 143, 421 b) 49 = 5⋅17−6⋅6,
143 = 5 ⋅ 49 − 6 ⋅ 17, 421 = 5 ⋅ 143 − 6 ⋅ 49 c) 5a
n−1
−
6a
n−2
=5(2
n−1
+ 5⋅3
n−1
) − 6(2
n−2
+ 5⋅3
n−2
) = 2
n−2
(10−6) +
3
n−2
(75 − 30) = 2
n−2
⋅ 4 + 3
n−2
⋅ 9 ⋅ 5 = 2
n
+ 3
n
⋅ 5 = a
n
13. a) Yes b) No c) No d) Yes e) Yes f) Yes g) No
h) No 15. a) a
n−1
+ 2a
n−2
+ 2n − 9 =−(n − 1) + 2 +
2[−(n − 2) + 2] + 2n − 9 =−n +2 = a
n
b) a
n−1
+
2a
n−2
+ 2n − 9 = 5(−1)
n−1
− (n − 1) + 2 + 2[5(−1)
n−2
−
(n − 2) + 2] + 2n − 9 = 5(−1)
n − 2
(−1 + 2) − n + 2 = a
n
c) a
n−1
+ 2a
n−2
+ 2n − 9 = 3(−1)
n−1
+2
n−1
− (n − 1) + 2 +
2[3(−1)
n−2
+ 2
n−2
− (n − 2) + 2] + 2n − 9 = 3(−1)
n−2
(−1 + 2) + 2
n−2
(2 + 2) − n + 2 = a
n
d) a
n−1
+
2a
n−2
+ 2n − 9 = 7 ⋅ 2
n−1
− (n − 1) + 2 + 2[7 ⋅ 2
n−2
−
(n − 2) + 2] + 2n − 9 = 2
n−2
(7 ⋅ 2 + 2 ⋅ 7) − n + 2 = a
n
17. a) a
n
= 2 ⋅ 3
n
b) a
n
= 2n + 3 c) a
n
= 1 + n(n + 1)∕2
d) a
n
= n
2
+ 4n + 4 e) a
n
= 1 f) a
n
= (3
n+1
− 1)∕2
g) a
n
= 5n! h) a
n
= 2
n
n! 19. a) a
n
= 3a
n−1
b) 5,904,900
21. a) a
n
= n + a
n−1
, a
0
= 0 b) a
12
= 78 c) a
n
= n(n + 1)∕2
P1: 1
ANS Rosen-2311T MH03280-Rosen-v1.cls May 8, 2018 17:25
Answers to Odd-Numbered Exercises S-17
23. B(k) = [1 + (0.07∕12)]B(k − 1) − 100, with B(0) = 5000
25. a) One 1 and one 0, followed by two 1s and two 0s, fol-
lowed by three 1s and three 0s, and so on; 1, 1, 1 b) The
positive integers are listed in increasing order with each
even positive integer listed twice; 9, 10, 10. c) The terms
in odd-numbered locations are the successive powers of 2;
the terms in even-numbered locations are all 0; 32, 0, 64.
d) a
n
= 3 ⋅ 2
n−1
; 384, 768, 1536 e) a
n
= 15 − 7(n − 1) =
22 − 7n; −34, −41, −48 f) a
n
= (n
2
+ n + 4)∕2; 57, 68,
80 g) a
n
= 2n
3
; 1024, 1458, 2000 h) a
n
= n!+1; 362881,
3628801, 39916801 27. Among the integers 1, 2, … ,a
n
,
where a
n
is the nth positive integer not a perfect square, the
nonsquares are a
1
,a
2
, … ,a
n
and the squares are 1
2
, 2
2
, … ,k
2
,
where k is the integer with k
2
< n+k < (k+1)
2
. Consequently,
a
n
= n + k,wherek
2
< a
n
< (k + 1)
2
. To find k,firstnote
that k
2
< n + k < (k + 1)
2
,sok
2
+ 1 ≤ n + k ≤ (k + 1)
2
− 1.
Hence, (k −
1
2
)
2
+
3
4
= k
2
− k + 1 ≤ n ≤ k
2
+ k = (k +
1
2
)
2
−
1
4
.
It follows that k −
1
2
<
n < k +
1
2
,sok ={
n} and
a
n
= n + k = n +{
n}. 29. a) 20 b) 11 c) 30 d) 511
31. a) 1533 b) 510 c) 4923 d) 9842 33. a) 21 b) 78
c) 18 d) 18 35.
n
j=1
(a
j
− a
j−1
) = a
n
− a
0
37. a) n
2
b) n(n + 1)∕2 39. 15150 41. 34320 43.
n(n+1)(2n+1)
3
+
n(n+1)
2
+ (n + 1)(m − (n + 1)
2
+ 1), where n =
m− 1
45. a) 0 b) 1680 c) 1 d) 1024 47. 34
Section 2.5
1. a) Countably infinite, −1, −2, −3, −4, … b) Countably
infinite, 0, 2, −2, 4, −4, … c) Countably infinite,
99, 98, 97, … d) Uncountable e) Finite f) Countably infi-
nite, 0, 7, −7, 14, −14, … 3. a) Countable: match n with
the string of n 1s. b) Countable. To find a correspondence,
follow the path in Example 4, but omit fractions in the top
three rows (as well as continuing to omit fractions not in low-
est terms). c) Uncountable d) Uncountable 5. Suppose m
new guests arrive at the fully occupied hotel. Move the guest
in Room n to Room m + n for n = 1, 2, 3, …; then the new
guests can occupy rooms 1 to m. 7. For n = 1, 2, 3, …, put
the guest currently in Room 2n into Room n, and the guest
currently in Room 2n − 1 into Room n of the new build-
ing. 9. Move the guest currently in Room i to Room 2i + 1
for i = 1, 2, 3, …. Put the jth guest from the kth bus into
Room 2
k
(2j + 1). 11. a) A = [1, 2] (closed interval of
real numbers from 1 to 2), B = [3, 4] b) A = [1, 2] ∪ Z
+
,
B = [3, 4] ∪ Z
+
c) A = [1, 3], B = [2, 4] 13. Suppose
that A is countable. Then either A has cardinality n for some
nonnegative integer n, in which case there is a one-to-one
function from A to a subset of Z
+
(the range is the first n pos-
itive integers), or there exists a one-to-one correspondence f
from A to Z
+
; in either case we have satisfied Definition 2.
Conversely, suppose that A ≤ Z
+
. By definition, this
means that there is a one-to-one function from A to Z
+
,soA
has the same cardinality as a subset of Z
+
(namely the range
of that function). By Exercise 16 we conclude that A is count-
able. 15. Assume that B is countable. Then the elements of
B can be listed as b
1
,b
2
,b
3
, . … Because A is a subset of B,
taking the subsequence of {b
n
} that contains the terms that
are in A gives a listing of the elements of A. Because A is
uncountable, this is impossible. 17. Assume that A − B is
countable. Then, because A = (A − B) ∪ (A ∩ B), the elements
of A can be listed in a sequence by alternating elements of
A − B and elements of A ∩ B. This contradicts the uncount-
ability of A. 19. We are given bijections f from A to B and g
from C to D. Then the function from A × C to B × D that sends
(a, c)to(f (a),g(c)) is a bijection. 21. By the definition of
A≤ B, there is a one-to-one function f : A → B. Similarly,
there is a one-to-one function g : B → C.ByExercise33
in Section 2.3, the composition
g◦f : A → C is one-to-one.
Therefore, by definition A ≤ C. 23. Using the Axiom
of Choice from set theory, choose distinct elements a
1
, a
2
,
a
3
, ...of A one at a time (this is possible because A is infi-
nite). The resulting set {a
1
,a
2
,a
3
, …} is the desired infinite
subset of A. 25. The set of finite strings of characters over
a finite alphabet is countably infinite, because we can list
these strings in alphabetical order by length. Therefore, the
infinite set S can be identified with an infinite subset of this
countable set, which by Exercise 16 is also countably infinite.
27. Suppose that A
1
,A
2
,A
3
, … are countable sets. Because
A
i
is countable, we can list its elements in a sequence as
a
i1
,a
i2
,a
i3
, … . The elements of the set
n
i=1
A
i
can be listed
by listing all terms a
ij
with i + j = 2, then all terms a
ij
with i + j = 3, then all terms a
ij
with i + j = 4, and so
on. 29. There are a finite number of bit strings of length m,
namely, 2
m
. The set of all bit strings is the union of the sets
of bit strings of length m for m = 0, 1, 2, … . Because the
union of a countable number of countable sets is countable
(see Exercise 27), there are a countable number of bit strings.
31. It is clear from the formula that the range of values the
function takes on for a fixed value of m + n,saym + n = x,is
(x − 2)(x − 1)∕2 + 1 through (x − 2)(x − 1)∕2 + (x − 1), be-
cause m can assume the values 1, 2, 3, … , (x − 1) under these
conditions, and the first term in the formula is a fixed positive
integer when m + n is fixed. To show that this function is
one-to-one and onto, we merely need to show that the range
of values for x + 1 picks up precisely where the range of
values for x left off, i.e., that f (x − 1, 1) + 1 = f (1,x). We have
f (x − 1
, 1) + 1 =
(x−2)(x − 1)
2
+ (x − 1) + 1 =
x
2
− x + 2
2
=
(x − 1)x
2
+ 1 = f (1,x). 33. By the Schr
¨
oder-Bernstein theo-
rem, it suffices to find one-to-one functions f :(0, 1) → [0, 1]
and g :[0, 1] → (0, 1). Let f (x) = x and g(x) = (x + 1)∕3.
35. Each element A of the power set of the set of positive
integers (i.e., A ⊆ Z
+
) can be represented uniquely by the
bit string a
1
a
2
a
3
…,wherea
i
= 1ifi ∈ A and a
i
= 0
if i ∉ A. Assume there were a one-to-one correspondence
f : Z
+
→ (Z
+
). Form a new bit string s = s
1
s
2
s
3
… by set-
ting s
i
to be 1 minus the ith bit of f (i). Then because s differs
in the i bit from f (i), s is not in the range of f , a contradiction.
37. For any finite alphabet there are a finite number of strings
of length n, whenever n is a positive integer. It follows by the
result of Exercise 27 that there are only a countable number
of strings from any given finite alphabet. Because the set of
P1: 1
ANS Rosen-2311T MH03280-Rosen-v1.cls May 8, 2018 17:25
S-18 Answers to Odd-Numbered Exercises
all computer programs in a particular language is a subset of
the set of all strings of a finite alphabet, which is a count-
able set by the result from Exercise 16, it is itself a countable
set. 39. Exercise 37 shows that there are only a countable
number of computer programs. Consequently, there are only
a countable number of computable functions. Because, as
Exercise 38 shows, there are an uncountable number of func-
tions, not all functions are computable. 41. a) Note that if
x is in the chain generated by y, then by the way the chains
are generated, y is in the chain generated by x,sothesetwo
chains are the same. Thus, if x is in both the chain generated
by y
1
and the chain generated by y
2
, then the chain generated
by y
1
and the chain generated by y
2
are both the same as the
chain generated by x and are therefore the same chain. b) A
moment’s reflection will show that by the way the chains
are constructed, this is true. c) Again, this is clear from the
construction. d) Because the chains are disjoint and every
element of A appears in exactly one chain and every element
of B appears in exactly one chain, the function h cannot map
two different elements of A tothesameelementofB. e) If an
element b of B appears in a chain of types 1, 2, or 3, then it is
preceded by an element of A, which maps to it under h.Ifb
appears in a chain of type 4, then it is followed by an element
of A, which maps to it under h.
Section 2.6
1. a) 3 × 4 b)
1
4
3
c)
2046
d) 1
e)
121
101
143
367
3. a)
111
218
b)
2 −2 −3
10 2
9 −44
c)
−415−41
−310 2 −3
02−86
1 −818−13
5.
9∕5 −6∕5
−1∕54∕5
7. 0 + A =
0 + a
ij
=
a
ij
+ 0
= 0 + A 9. A + (B + C) =
a
ij
+ (b
ij
+ c
ij
)
=
(a
ij
+ b
ij
) + c
ij
= (A + B) + C 11. The
number of rows of A equals the number of columns of B,and
the number of columns of A equals the number of rows of B.
13. A(BC) =
q
a
iq
r
b
qr
c
rl
=
q
r
a
iq
b
qr
c
rl
=
r
q
a
iq
b
qr
c
rl
=
r
q
a
iq
b
qr
c
rl
= (AB)C
15. A
n
=
1 n
01
17. a) Let A = [a
ij
]andB = [b
ij
]. Then
A + B = [a
ij
+ b
ij
]. We have (A + B)
t
= [a
ji
+ b
ji
] = [a
ji
] +
[b
ji
] = A
t
+ B
t
. b) Using the same notation as in part (a), we
have B
t
A
t
=
q
b
qi
a
jq
=
q
a
jq
b
qi
= (AB)
t
, because
the (i, j)th entry is the (j, i)th entry of AB. 19. The result
follows because
ab
cd
d −b
−ca
=
ad −bc 0
0 ad − bc
=
(ad − bc)I
2
=
d −b
−ca
ab
cd
. 21. A
n
(A
−1
)
n
=
A(A ⋯(A(AA
−1
)A
−1
) ⋯ A
−1
)A
−1
bytheassociativelaw.
Because AA
−1
= I, working from the inside shows that
A
n
(A
−1
)
n
= I. Similarly (A
−1
)
n
A
n
= I. Therefore, (A
n
)
−1
=
(A
−1
)
n
. 23. The (i, j)th entry of A + A
t
is a
ij
+ a
ji
,which
equals a
ji
+ a
ij
,the(j, i)th entry of A + A
t
, so by definition
A + A
t
is symmetric. 25. x
1
= 1, x
2
=−1, x
3
=−2
27. a)
111
111
101
b)
001
100
001
c)
111
111
101
29. a)
100
110
101
b)
100
101
110
c)
100
111
111
31. a) A∨B = [a
ij
∨ b
ij
] = [b
ij
∨a
ij
] = B ∨ Ab)A∧ B =
[a
ij
∧ b
ij
] = [b
ij
∧ a
ij
] = B ∧ A 33. a) A ∨ (B ∧ C) =
[a
ij
] ∨ [b
ij
∧ c
ij
] = [a
ij
∨ (b
ij
∧ c
ij
)] = [(a
ij
∨ b
ij
) ∧
(a
ij
∨c
ij
)] = [a
ij
∨b
ij
] ∧[a
ij
∨c
ij
] = (A∨B)∧(A∨C) b) A∧(B∨
C) = [a
ij
]∧[b
ij
∨c
ij
] = [a
ij
∧(b
ij
∨c
ij
)] = [(a
ij
∧b
ij
)∨(a
ij
∧c
ij
)] =
[a
ij
∧ b
ij
] ∨ [a
ij
∧ c
ij
] = (A ∧ B) ∨ (A ∧ C) 35. A ⊙ (B ⊙ C) =
q
a
iq
∧
r
b
qr
∧ c
rl
=
q
r
a
iq
∧ b
qr
∧c
rl
=
r
q
a
iq
∧b
qr
∧c
rl
=
r
q
a
iq
∧ b
qr
∧ c
rl
=
(A ⊙ B) ⊙ C
Supplementary Exercises
1. a) A b) A ∩ B c) A − B d) A ∩ B e) A ⊕ B
3. Yes 5. A − (A −B) = A−(A ∩
B) = A ∩ (A∩B) = A ∩
(
A ∪ B) = (A ∩ A) ∪ (A ∩ B) =∅∪(A ∩ B) = A ∩ B 7. Let
A ={1}, B =∅, C ={1}.Then(A − B) − C =∅, but
A − (B − C) ={1}. 9. No. For example, let A = B =
{a, b}, C =∅,andD ={a}.Then(A − B) − (C − D) =
∅−∅=∅, but (A − C) − (B − D) ={a, b}−{b}={a}.
11. a) ∅ ≤ A ∩ B ≤ A ≤ A ∪ B ≤ U b) ∅ ≤
A − B ≤ A ⊕ B≤ A ∪ B≤ A+ B 13. a) Yes, no
b) Yes, no c) f has inverse with f
−1
(a) = 3,f
−1
(b) = 4,
f
−1
(c) = 2, f
−1
(d ) = 1; g has no inverse. 15. If f is one-to-
one, then f provides a bijection between S and f (S), so they
have the same cardinality. If f is not one-to-one, then there ex-
ist elements x and y in S such that f (x) = f (y). Let S ={x, y}.
Then S = 2 but f (S) = 1. 17. Let x ∈ A.Then
S
f
({x}) ={f (y) ∣ y ∈{x}} = {f (x)}. By the same reasoning,
S
g
({x}) ={g(x)}. Because S
f
= S
g
, we can conclude that
{f (x)}={g(x)}, and so necessarily f (x) = g(x). 19. The
equation is true if and only if the sum of the fractional parts
of x and y is less than 1. 21. The equation is true if and only
if either both x and y are integers, or x is not an integer but the
sum of the fractional parts of x and y is less than or equal to 1.
23. If x is an integer, then x+ m − x= x + m − x = m.
Otherwise, write x in terms of its integer and fractional parts:
x = n + 𝜖,wheren = xand 0 <𝜖<1. In this case x+
P1: 1
ANS Rosen-2311T MH03280-Rosen-v1.cls May 8, 2018 17:25
Answers to Odd-Numbered Exercises S-19
m − x=n + 𝜖+ m − n − 𝜖= n + m − n − 1 = m − 1.
25. Write n = 2k+1 for some integer k.Thenn
2
= 4k
2
+4k+1,
so n
2
∕4 = k
2
+ k +
1
4
. Therefore, n
2
∕4= k
2
+ k + 1. But
(n
2
+ 3)∕4 = (4k
2
+ 4k + 1 + 3)∕4 = k
2
+ k + 1. 27. Let
x = n + (r∕m) + 𝜖,wheren is an integer, r is a nonnegative
integer less than m,and𝜖 is a real number with 0 ≤ 𝜖<1∕m.
The left-hand side is nm + r + m𝜖= nm + r. On the right-
hand side, the terms xthrough x + (m + r − 1)∕mare all
just n and the terms from x + (m − r)∕mon are all n + 1.
Therefore, the right-hand side is (m − r)n + r(n + 1) = nm + r,
as well.
29. 101 31. a
1
= 1; a
2n+1
= n ⋅ a
2n
for all
n > 0; and a
2n
= n + a
2n−1
for all n > 0. The next
four terms are 5346, 5353, 37, 471, and 37, 479. 33. If each
f
−1
(j) is countable, then S = f
−1
(1) ∪ f
−1
(2) ∪ ⋯ is the
countable union of countable sets and is therefore countable
by Exercise 27 in Section 2.5. 35. Because there is a one-
to-one correspondence between R and the open interval (0, 1)
(given by f (x) = 2 arctan(x)∕𝜋), it suffices to shows that
(0, 1) × (0, 1)= (0, 1). By the Schr
¨
oder-Bernstein theorem
it suffices to find injective functions f :(0, 1) → (0, 1) × (0, 1)
and g :(0, 1) × (0, 1) → (0, 1). Let f (x) = (x,
1
2
). For g we
follow the hint. Suppose (x, y) ∈ (0, 1) × (0, 1), and represent
x and y with their decimal expansions x = 0.x
1
x
2
x
3
… and
y = 0. y
1
y
2
y
3
…, never choosing the expansion of any number
that ends in an infinite string of 9s. Let g(x, y) be the decimal
expansion obtained by interweaving these two strings, namely
0.x
1
y
1
x
2
y
2
x
3
y
3
…. 37. A
4n
=
10
01
, A
4n+1
=
01
−10
,
A
4n+2
=
−10
0 −1
, A
4n+3
=
0 −1
10
, for n ≥ 0
39. Suppose that A =
ab
cd
. Let B =
01
00
. Be-
cause AB = BA, it follows that c = 0anda = d.Let
B =
00
10
. Because AB = BA, it follows that b = 0.
Hence, A =
a 0
0 a
= aI. 41. a) Let A ⊙ 0 =
b
ij
.Then
b
ij
= (a
i1
∧0) ∨ ⋯ ∨(a
ip
∧0) = 0. Hence, A⊙0 = 0. Similarly,
0⊙A = 0. b) A∨0 =
a
ij
∨ 0
=
a
ij
= A. Hence, A∨0 = A.
Similarly, 0 ∨ A = A. c) A ∧ 0 =
a
ij
∧ 0
= [0] = 0. Hence,
A ∧ 0 = 0. Similarly, 0 ∧ A = 0.
CHAPTER 3
Section 3.1
1. max := 1, i := 2, max := 8, i := 3, max := 12, i := 4,
i := 5, i := 6, i := 7, max := 14, i := 8, i := 9, i := 10, i := 11
3. procedure AddUp(a
1
, … ,a
n
: integers)
sum : = a
1
for i :=2to n
sum := sum + a
i
return sum
5. procedure duplicates(a
1
,a
2
, … ,a
n
: integers in
nondecreasing order)
k := 0 {this counts the duplicates}
j := 2
while j ≤ n
if a
j
= a
j−1
then
k := k + 1
c
k
:= a
j
while j ≤ n and a
j
= c
k
j := j + 1
j := j + 1
{c
1
,c
2
, … ,c
k
is the desired list}
7. procedure last even location(a
1
,a
2
, … ,a
n
: integers)
k := 0
for i := 1 to n
if a
i
is even then k := i
return k {k = 0 if there are no evens}
9. procedure palindrome check(a
1
a
2
… a
n
: string)
answer := true
for i := 1 to n∕2
if a
i
≠ a
n+1−i
then answer := false
return answer
11. procedure interchange(x, y: real numbers)
z := x
x := y
y := z
The minimum number of assignments needed is three.
13. Linear search: i := 1, i := 2, i := 3, i := 4, i := 5, i := 6,
i := 7, location := 7; binary search: i := 1, j := 8, m := 4,
i := 5, m := 6, i := 7, m := 7, j := 7, location := 7
15. procedure insert(x, a
1
,a
2
, … ,a
n
: integers)
{the list is in order: a
1
≤ a
2
≤ ⋯ ≤ a
n
}
a
n+1
:= x + 1
i := 1
while x > a
i
i := i + 1
for j := 0 to n − i
a
n−j+1
:= a
n−j
a
i
:= x
{x has been inserted into correct position}
17. procedure first largest(a
1
, … ,a
n
: integers)
max := a
1
location := 1
for i := 2 to n
if max < a
i
then
max := a
i
location := i
return location
19. procedure mean-median-max-min(a, b, c: integers)
mean := (a + b + c)∕ 3
{the six different orderings of a, b, c with respect
to ≥ will be handled separately}
P1: 1
ANS Rosen-2311T MH03280-Rosen-v1.cls May 8, 2018 17:25
S-20 Answers to Odd-Numbered Exercises
if a ≥ b then
if b ≥ c then median := b; max := a; min := c
⋮
(The rest of the algorithm is similar.)
21. procedure first-three(a
1
,a
2
, … ,a
n
: integers)
if a
1
> a
2
then interchange a
1
and a
2
if a
2
> a
3
then interchange a
2
and a
3
if a
1
> a
2
then interchange a
1
and a
2
23. procedure onto( f : function from A to B,where
A ={a
1
, … ,a
n
}, B ={b
1
, … ,b
m
}, a
1
, … ,a
n
,
b
1
, … ,b
m
are integers)
for i := 1 to m
hit(b
i
):= 0
count := 0
for j := 1 to n
if hit( f (a
j
)) = 0 then
hit( f (a
j
)) := 1
count := count + 1
if count = m then return true else return false
25. procedure ones(a: bit string, a = a
1
a
2
… a
n
)
count:= 0
for i := 1 to n
if a
i
:= 1 then
count := count + 1
return count
27. procedure ternary search(s: integer, a
1
,a
2
, … ,a
n
:
increasing integers)
i := 1
j := n
while i < j − 1
l := (i + j)∕3
u := 2(i + j)∕3
if x > a
u
then i := u + 1
else if x > a
l
then
i := l + 1
j := u
else j := l
if x = a
i
then location := i
else if x = a
j
then location := j
else location := 0
return location {0 if not found}
29. procedure find a mode(a
1
,a
2
, … ,a
n
: nondecreasing
integers)
modecount := 0
i := 1
while i ≤ n
value := a
i
count := 1
while i ≤ n and a
i
= value
count := count + 1
i := i + 1
if count > modecount then
modecount := count
mode := value
return mode
31. Assume the input is strings a
1
a
2
…a
n
and b
1
b
2
…b
n
,
where each character is a letter, A through Z. Assume also
that a function index is available, such that index(x)isthe
position of the letter x in the alphabet (index(‘A’) = 1, ...,
index(‘Z’) = 26). a) Initialize a-count and b-count to be
lists of length 26 with all values equal to 0. For i from 1
to n increment a-count(index(a
i
)) and b-count(index(b
i
)). If
a-count(i) = b-count(i)foralli from 1 to 26, then return
“true”; otherwise return “false.” b) Sort both strings into al-
phabetical order. Then the two original strings were anagrams
if and only if the sorted strings are identical.
33. procedure find duplicate(a
1
,a
2
, … ,a
n
: integers)
location := 0
i := 2
while i ≤ n and location = 0
j := 1
while j < i and location = 0
if a
i
= a
j
then location := i
else j := j + 1
i := i + 1
return location
{location is the subscript of the first value that
repeats a previous value in the sequence}
35. procedure find decrease(a
1
,a
2
, … ,a
n
: positive
integers)
location := 0
i := 2
while i ≤ n and location = 0
if a
i
< a
i−1
then location := i
else i := i + 1
return location
{location is the subscript of the first value less than
the immediately preceding one}
37. At the end of the first pass: 1, 3, 5, 4, 7; at the end of the
second pass: 1, 3, 4, 5, 7; at the end of the third pass: 1, 3, 4,
5, 7; at the end of the fourth pass: 1, 3, 4, 5, 7
39. procedure better bubblesort(a
1
, … ,a
n
: integers)
i : = 1; done : = false
while i < n and done = false
done : = true
for j : = 1 to n − i
if a
j
> a
j+1
then
interchange a
j
and a
j+1
done : = false
i : = i + 1
{a
1
, … ,a
n
is in increasing order}
41. At the end of the first, second, and third passes: 1, 3, 5, 7, 4;
at the end of the fourth pass: 1, 3, 4, 5, 7 43. a) 1, 5, 4, 3, 2;
1, 2, 4, 3, 5; 1, 2, 3, 4, 5; 1, 2, 3, 4, 5 b) 1, 4, 3, 2, 5; 1,
2, 3, 4, 5; 1, 2, 3, 4, 5; 1, 2, 3, 4, 5 c) 1, 2, 3, 4, 5; 1, 2, 3,
4, 5; 1, 2, 3, 4, 5; 1, 2, 3, 4, 5 45. We carry out the linear
search algorithm given as Algorithm 2 in this section, except
that we replace x ≠ a
i
by x < a
i
, and we replace the else
clause with else location := n + 1. 47. 2 + 3 + 4 + ⋯ + n =
(n
2
+n−2)∕2 49. Find the location for the 2 in the list 3 (one
剩余97页未读,继续阅读
2012-09-10 上传
2017-03-04 上传
2024-05-30 上传
2015-07-23 上传
2016-12-02 上传
2017-07-09 上传
点击了解资源详情
Y3210100085
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 俄罗斯RTSD数据集实现交通标志实时检测
- 易语言开发的文件批量改名工具使用Ex_Dui美化界面
- 爱心援助动态网页教程:前端开发实战指南
- 复旦微电子数字电路课件4章同步时序电路详解
- Dylan Manley的编程投资组合登录页面设计介绍
- Python实现H3K4me3与H3K27ac表观遗传标记域长度分析
- 易语言开源播放器项目:简易界面与强大的音频支持
- 介绍rxtx2.2全系统环境下的Java版本使用
- ZStack-CC2530 半开源协议栈使用与安装指南
- 易语言实现的八斗平台与淘宝评论采集软件开发
- Christiano响应式网站项目设计与技术特点
- QT图形框架中QGraphicRectItem的插入与缩放技术
- 组合逻辑电路深入解析与习题教程
- Vue+ECharts实现中国地图3D展示与交互功能
- MiSTer_MAME_SCRIPTS:自动下载MAME与HBMAME脚本指南
- 前端技术精髓:构建响应式盆栽展示网站
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功