Docsity

CIS 400/628 Homework Assignment for Spring 2005, Assignments of Computer Science

Toggle sidebar
bg1
CIS 400/628
Homework #2
Spring 2005
Due: 8 Feb 2005
1. (Lewand, Exercises 1.1, #7) Prove that n<2nfor all integers n≥1.
2. (Lewand, Exercises 2.2, #2) Evaluate C(7, 5) and C(7, 2). Explain why you get the same answer for
both expressions. Generalize your discovery to C(n,r) and C(n, n-r).
3. (Lewand, Exercises 2.2, #3) Evaluate P(7, 5) and P(7, 2). Explain why you do not get the same
answer for both expressions.
4. (Lewand, Exercises 2.3, #3) Four cards are to be drawn simultaneously from a standard deck of 52.
Find the probability that:
(a) all four are clubs.
(b) at least one is not a club.
(c) three are black and one is red.
(d) exactly two are picture cards.
(e) either two or three of the four cards are picture cards.
5. (Lewand, Exercises 2.3, # 8) A lottery consists of 48 numbers, of which 8 are selected by the lottery
authority. To win, you need to have played either 7 or 8 of the numbers selected by the authority. If
you pick exactly 7, you win $20,000; if you pick 8 you win $50,000. What is the probability that
you
(a) win $50,000?
(b) win $20,000?
6. Write a program that takes a keyword as a command line argument, then performs the Vigen`
re cipher
on the standard input.
7. (Extra credit for undergrads, required of graduate students) Modify your program to decrypt the
Vigen`
ere cipher, again reading the key from standard input. (You could just add a -d flag to your
program.) This is not a program to cryptanalyze an unknown Vigen`
ere cipher.

Partial preview of the text

Download CIS 400/628 Homework Assignment for Spring 2005 and more Assignments Computer Science in PDF only on Docsity!

CIS 400/

Homework

Spring 2005

Due: 8 Feb 2005

  1. (Lewand, Exercises 1.1, #7) Prove that n < 2 n^ for all integers n ≥ 1.
  2. (Lewand, Exercises 2.2, #2) Evaluate C(7, 5) and C(7, 2). Explain why you get the same answer for both expressions. Generalize your discovery to C(n,r) and C(n, n-r).
  3. (Lewand, Exercises 2.2, #3) Evaluate P(7, 5) and P(7, 2). Explain why you do not get the same answer for both expressions.
  4. (Lewand, Exercises 2.3, #3) Four cards are to be drawn simultaneously from a standard deck of 52. Find the probability that:

(a) all four are clubs. (b) at least one is not a club. (c) three are black and one is red. (d) exactly two are picture cards. (e) either two or three of the four cards are picture cards.

  1. (Lewand, Exercises 2.3, # 8) A lottery consists of 48 numbers, of which 8 are selected by the lottery authority. To win, you need to have played either 7 or 8 of the numbers selected by the authority. If you pick exactly 7, you win $20,000; if you pick 8 you win $50,000. What is the probability that you

(a) win $50,000? (b) win $20,000?

  1. Write a program that takes a keyword as a command line argument, then performs the Vigen`re cipher on the standard input.
  2. (Extra credit for undergrads, required of graduate students) Modify your program to decrypt the Vigenere cipher, again reading the key from standard input. (You could just add a -d flag to your program.) This is _not_ a program to cryptanalyze an unknown Vigenere cipher.