Download presentation

Presentation is loading. Please wait.

Published byGael Roycroft Modified over 3 years ago

1
CSC 2510 Test 3 1. Give the names of the formula or rule that provides the answer for each of the following problems. Do not try to solve the problems!

2
1.a. How many cards must be selected from a standard deck of 52 cards to guarantee that at least three cards of the same suit are chosen? Givens: Standard deck = 4 suits Find: max(suit1 + suit1 + suit1 + suit1) ≤ 3 + 1

3
1.a. max( ) ≤ 3 Answer: Sum rule (Pigeon hole accepted also) max( ) ≤ = 9 (You can chose 2 (indistinguishable) from each group before the next card will ensure that you have three of a suit)

4
1.b. How many bit strings of length eight either start with a 1 bit or end with the two bits 10? There are 28 strings = 256 possible strings. 1/2 of the strings begin with 1 for 128 strings 1/4 of the strings end in 10 for 1/4 * 28 = 64 strings But 1/2 of the 1/4 * 28 for 32 strings also start with 1 so they must be subtracted out again = 160.

5
1.b. Subtraction rule.

6
1.c. How many bit strings of length n are there? Given: bit strings = 2 choices length = n (or repeated n times) bits are indistinguishable each choice is either a 0 or a 1

7
**2n (two choices for each bit - choicestimes)**

8
1.d. How many ways can you solve a task if the task can be done in one of n1 ways or in one of n2 ways? Given: n1 ways + n2 ways Answer: Sum rule

9
2.a. Convert the octal value 7016 to binary. 70168 = Convert the octal digits to binary in groups of three using the table. =

10
**Convert the octal value 7016 to hex.**

2.b. Convert the octal value 7016 to hex. 70168 = Convert the octal digits to binary in groups of three using the table. Then regroup into groups of 4 start from right: Then convert to hex using table (you should learn the conversion: = E0E16

11
2.c. Convert the octal value 7016 to decimal = 7 * * * *80 = 7 * = =

12
2.d. Convert decimal to hex /16 = 1116 mod /16 = 69 mod 12 = C 69/16 = 4 mod 5 4/16 = 0 mod 4 = 45C516 (remainder of 0 indicates we are finished)

13
**Convert decimal 1740 to octal.**

1740/8 = 217 mod 4 217/8 = 27 mod 1 27/8 = 3 mod 3 3/8 = 0 mod 3 = (remainder of 0 indicates we are finished)

14
3. What formula would you use in each of the following cases? Example: permutation: P(n) = n!.

15
3.a. A procedure has n1 ways to do task 1 and n2 ways to do task 2: n1 * n2 or product rule

16
**A task may use one of group n1 or one of n2 to do a task:**

3.b. A task may use one of group n1 or one of n2 to do a task: n1 + n2 or sum rule (no overlap between groups – all tasks are independent)

17
3.c. An ordered arrangement of r elements: P(n,r) or n!/(n - r)! or n(n-1)(n-2)...(n-r+1) (r ordered elements out of n)

18
3.d. The number of r-permutations of a set of n objects with repetition: nr (with repetition means that each time you get to choice n items – the amount you can choice never gets smaller than n so that you choice n r times)

19
3.e. An unordered selection of r elements from a set with n distinct elements: C(n, r) or n!/(r! * (n-r)!) (unordered is a combination and divides r! back out – (the duplicates))

20
3.f. The number of r-permutations of a set of n objects with repetition: nr (Same question as 3.d.)

21
**or factorial expansion of the above**

3.g. The number of ways to select r items from n indistinguishable objects: (Think cookies). (the size of r may be greater than, less than, or equal to the size of n) C(n + r -1, r) or C(n + r - 1, n -1) or factorial expansion of the above C(n + r -1, r) = C(n + r - 1, n -1) because (n+ r-1)/((n+r-1-r)!*r!) = (n+ r-1)/((n-1+(r-r))!*r!) = (n+ r-1)/((n-1)!*r!)

22
3.h. The number of ways to select r items from n indistinguishable objects and do it until less than r items remains: C(n,r)C(n-r,r)C(n-r-r,r) * (etc.) (Any expression of same.)

23
4.a. Give the Euclidean Algorithm for greatest common divisor: procedure gcd(a, b: positive integers) x := a y := b while y 0 r := x mod y x := y y := r return x {gcd(a, b) is x}

24
4.a. or procedure gcd(a, b: positive integers) x := a y := b if y = 0 return x return gcd(y, x mod y) if b = 0 return a return gcd(b, a mod b)

25
4.b. Showing the steps, find gcd(91, 287): 287/91 = 91 * /14 = 14 * /7 = 7 * (remainder of 0 indicates we are finished) = 7

26
**5. Let P(n) be the statement that**

(2n + 1)2 = (n + 1)(2n + 1)(2n + 3)/3 whenever n is a nonnegative integer. Be sure to use the formal proof that includes Basis Step.

27
**5. Basis step: Show that P(0) is true. Let n = 0.**

Then (2(0) + 1)2 = ((0) + 1)(2(0) + 1) (2(0) + 3)/3 1 = (1)(1)(3)/3 = 1. Since both sides equal 1, P(0) must be true Induction Hypotheses: (2k + 1)2 = (k + 1)(2k + 1)(2k + 3)/3 Induction Step: Show that (2k + 1)2 + (2(k+1) + 1)2 = ((k + 1) + 1)(2(k + 1) + 1)(2(k + 1) + 3)/3 is true.

28
5. Proof: (2k + 1)2 + (2(k+1) + 1)2 = ((k + 1) + 1)(2(k + 1) + 1)(2(k + 1) + 3)/3 (k + 1)(2k + 1)(2k + 3)/3 + (2(k+1) + 1)2 = ((k + 1) + 1)(2(k + 1) + 1)(2(k + 1) + 3)/3 (k + 1)(2k + 1)(2k + 3)/3 + 3/3 * (2k + 3)2 = ((k + 2)(2k + 3)(2k + 5)/3 ((k + 1)(2k + 1)(2k + 3) + 3(2k + 3)2)/3 = ((k + 2)(2k + 3)(2k + 5)/3 (k + 1)(2k + 1)(2k + 3) + 3(2k + 3)2 = ((k + 2)(2k + 3)(2k + 5) (k + 1)(2k + 1) + 3(2k + 3) = ((k + 2)(2k + 5) 2k2 + 3k k + 9 = 2k2 + 9k + 10 2k2 + 9k = 2k2 + 9k + 10 1 = 1 We have shown that the induction hypotheses is true by showing that the left side equals the right side for k + 1.

29
6.a. Give a recursive algorithm (in the pseudo format specified in appendix A3) for computing: ni=0 i. procedure series(n; integer) If n = 0 return 0 return n + series (n-1) {returns the sum of the first n values}

30
**( means product, so each value is multiplied to the previous)**

6.b. Show the value of ni=0 i generated at each step from 0 to n = 4. means sum, so each value is added to the previous ( means product, so each value is multiplied to the previous)

31
**7. Answer the following questions.**

How many bit strings of length n are there? 2n Same question as 3.d and 3.f. b. How many bit strings of length 16 are there? (two choices for each bit - choicestimes) What is the formula that you used? (Same answer as a.)

32
8.a. What rule would you use to compute how many bit strings of length eight either start with a 1 bit or end with the two bits 10? Subtraction rule (1/2 of 28 plus 1/4 of 28 minus 1/4 of 1/2 of 22) (areas common to both need to be subtracted out)

33
8.b. How many bit strings of length eight either start with a 1 bit or end with the two bits 10? (1/2 of 28 =) (1/4 of 28 = ) 64 - (1/4 of 1/2 of 26 = ) 32 = 160

34
9.a. A multiple-choice test contains 10 questions. There are 4 possible answers for each question. In how many ways can a student answer every question (one answer per question)? (4 ways per question, 10 questions) 410 (10 questions with four choices each, - 410, ntimes or waysquestions)

35
9.b. A multiple-choice test contains 10 questions. There are 4 possible answers for each question. In how many ways can a student answer the question on the test if the student can leave answers blank? (5 ways per question, 10 questions) 510 (10 questions with five choices each, - 510)

36
**10. Given a set with n items; **

a. What formula would you chose to select r items in order? P(n, r) or n!/(n-r)! b. How many possibilities would you have with n = 20 and r = 3. P(20, 3) or 20!/(20-3)! or 20*19*18 c. What is that formula called? r-permutations

37
11. Show formula used reducing factors as much as possible but not necessary to multiply and divide once reduced.

38
11.a. How many ways are there to distribute hands of 5 cards to each of four players from the standard deck of 52 cards? (Poker hands) C(52,5)C(47,5)C(42,5)C(37,5) or 52!/((52-5)!5!) * 47!/((47-5)!5!) * 42!/((42-5)!5!) * 37!/((37-5)!5!) = 52! / (47! * 5!) * 47! / (42! * 5!) * 42! / (37! * 5!) * 37! / (32! * 5!) = (52! / (5! * 5! * 5! * 32! * 5! ) = (52! / (5! 5! 5! 5! 32!)

39
**11.b. n1 = 52, r1 = 5 (if in answer, accept)**

For each hand what is the value of (the first n) n? Of r? n1 = 52, r1 = 5 (if in answer, accept) n2 = 47, r2 = 5, n3 = 42, r3= 5, n4 = 37, r4 = 5.

40
**11.c. Which formula should be used? **

C(52,5)C(47,5)C(42,5)C(37,5) or accept the following partial (incorrect) answers If C(52,5) or 52!/((52-5)! * 5!) or 52! / (47! * 5!) is in answer, accept answer.

41
12. Show formula used reducing factors as much as possible but not necessary to multiply and divide once reduced.

42
12.a. How many ways are there to distribute hands of 13 cards to each of four players from the standard deck of 52 cards? (Bridge hands) C(52,13)C(39,13)C(26,13)C(13,13) or 52!/((52-13)! 13!) * 39!/((39-13)! 13!) * 26!/((26-13)! 13!) * 13!/((13-13)!13!) = 52! / (39! 13!) * 39! / (26! 13!) * 26! / (13! 13!) * 13! / (0! 13!) = 52! / (1! 13!) * 1! / 1! 13!) * 1! / (1! 13!) * 1! / (0! 13!) or 52! / (13! 13! 13! 13!)

43
**12.b For each hand what is the value of n? Of r? n1 = 52, r1 =13,**

n1 = 52, r1 =13, n2 = 39, r2 =13, n3 = 26, r3 =13, n4 = 13, r4 =13 If C(52,13) or 52!/((52-13)! * 13!) is in answer, accept answer.

44
**If C(52,13) or 52!/((52-13)! * 13!) is in answer, accept answer.**

Which formula should be used? r-combinations or C(52,13)C(39,13)C(26,13)C(13,13) If C(52,13) or 52!/((52-13)! * 13!) is in answer, accept answer.

Similar presentations

OK

Introduction To Number Systems Binary System M. AL-Towaileb1.

Introduction To Number Systems Binary System M. AL-Towaileb1.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on low level language assembly Ppt on fibonacci numbers and nature Ppt on point contact diode construction Ppt on obesity prevention program Ppt on game theory mario Ppt on rotating magnetic field Waters view ppt on ipad Download ppt on smart note taker Ppt on history of australia prisoners Ppt on medicinal plants in india