CS1050 Homework 9 Answers and Explanations, Assignments of Computer Science

The answers and explanations for homework 9 of a computer science course, cs1050. It covers various topics including equivalence relations, transitivity, and the pigeonhole principle. Students can use this document to check their solutions and understand the concepts better.

Typology: Assignments

Pre 2010

Uploaded on 08/04/2009

koofers-user-sym
koofers-user-sym 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS1050 HW 9 Answer Key
There are 124 points total over the entire homework.
Section 7.5, p. 513-515, 2, 16, 42
Section 4.1, p. 311, 16, 28
Section 4.2, p. 319, 12, 14
Section 4.3, p. 325, 10, 14
Section 7.5
2) [4 points each]
a. Yes
b. Yes
c. No, not transitive
d. No, not transitive
e. No, not transitive. A and B speak English; B and C speak Spanish, but A doesn't
(nor does C speak English).
16) [10 points]
Yes, the relation is an equivalence relation.
42) [3 points each]
a. No (May not be transitive)
b. Yes
c. No (May not be reflexive)
Section 4.1
16) [10 points]
264 - 254 = 456976 - 390625 = 66351
28) [ 3 points each]
How many strings of eight English letters are there
a. If letters can be repeated.
268
b. If no letters can be repeated.
26*25*24*23*22*21*20*19
c. That start with X, if letters can be repeated.
267
d. That start with X, if no letters can be repeated.
25*24*23*22*21*20*19
e. That start and end with X, if letters can be repeated.
266
f. That start with the letters BO (in that order), if letters can be repeated.
266
g. That start and end with the letters BO (in that order), if letters can be repeated.
264
pf2

Partial preview of the text

Download CS1050 Homework 9 Answers and Explanations and more Assignments Computer Science in PDF only on Docsity!

**CS1050 HW 9 Answer Key There are 124 points total over the entire homework. Section 7.5, p. 513-515, 2, 16, 42 Section 4.1, p. 311, 16, 28 Section 4.2, p. 319, 12, 14 Section 4.3, p. 325, 10, 14 Section 7.

  1. [4 points each]** a. Yes b. Yes c. No, not transitive d. No, not transitive e. No, not transitive. A and B speak English; B and C speak Spanish, but A doesn't (nor does C speak English). 16) [10 points] Yes, the relation is an equivalence relation. 42) [3 points each] a. No (May not be transitive) b. Yes c. No (May not be reflexive) **Section 4.
  2. [10 points]** 264 - 25^4 = 456976 - 390625 = 66351 28) [ 3 points each] How many strings of eight English letters are there a. If letters can be repeated. 268 b. If no letters can be repeated. 26252423222120* c. That start with X, if letters can be repeated. 267 d. That start with X, if no letters can be repeated. 252423222120 e. That start and end with X, if letters can be repeated. 266 f. That start with the letters BO (in that order), if letters can be repeated. 266 g. That start and end with the letters BO (in that order), if letters can be repeated. 264

h. That start or end with the letters BO (in that order), if letters can be repeated 266 + 26^6 - 26^4 (Subtraction is to remove overcounting.) **Section 4.

  1. [15 points]** How many ordered pairs of integers (a, b) are needed to guarantee that there are two ordered pairs {a1, b1} and {a2, b2} such that a1 mod5 = a2 mod5, and b1 mod5 = b mod5. Answer: The remainder can be 0, 1, 2, 3, or 4. So according to the pigeonhole principle, we have 5*5 (5 for a and 5 for b). Thus we need 25 + 1 = 26 ordered pairs. 14) [16 points] a. Show that if seven integers are selected from the first 10 positive integers, there must be at least two pairs of these integers with the sum 11. Proof: We can group the 10 positive integers into 5 subsets of two integers each, with each subset adding to 11: {1, 10} {2, 9} {3,8} {4, 7} {5, 6}. If we choose 7 numbers from these 10 positive integers, by the pigeonhole principle, there are at least two integers that fall in the same subset. Furthermore, if we disregard these two, there are 5 integers and 4 subsets left. Thus by the pigeonhole principle there are at least two other integers that fall in the same subset. So there are at least two pairs that add to 11. b. No, because there are then 6 integers and 5 subsets. By the argument above, it is guaranteed that there is only at least one subset with two integers. This can also be shown with a counterexample: [1, 2, 3, 4, 5, 6] has only one pair that sums to 11. **Section 4.
  2. [10 points]** There are six different candidates for governor of a state. In how many different orders can the names of the candidates be printed on the ballot? 654321 = 720 14) [10 points] In how many ways can a set of two positive integers less than 100 be chosen? The set is {1 - 99}. Order doesn't matter so the result is C(99,2) = 99!/(2!97!) = 9998/2 = 4851.