Docsity

CS174 Midterm 2, Spring 98: Permutations, Matrix Inversion, Fingerprint Trees, Exams of Discrete Mathematics

Toggle sidebar
bg1
CS174 Midterm 2 Spring 98
J. Canny April 7
This is a closed-book exam with 4 questions. The marks for each question are shown in parenthe-
ses, and the total is 60 points. Make sure you allocate enough time to attempt all the questions.
You are allowed to use the formula sheet that will be handed out with the exam. No other notes are
allowed. Calculators are OK. Write all your answers in this booklet. Good Luck!
NAME
SID Number
1
pf3
pf4
pf5

Partial preview of the text

Download CS174 Midterm 2, Spring 98: Permutations, Matrix Inversion, Fingerprint Trees and more Exams Discrete Mathematics in PDF only on Docsity!

CS174 Midterm 2 Spring 98

J. Canny April 7

This is a closed-book exam with 4 questions. The marks for each question are shown in parenthe- ses, and the total is 60 points. Make sure you allocate enough time to attempt all the questions. You are allowed to use the formula sheet that will be handed out with the exam. No other notes are allowed. Calculators are OK. Write all your answers in this booklet. Good Luck!

NAME

SID Number

  1. (20 points) Count the number of permutations (with repeats) of length k of the 5 characters a, b, c, d, e, if:

(a) There are exactly two occurences of the substring “ab”? (b) There are exactly two occurrences of the substring “aa”? Note that the substring “aaa” counts as two occurrences.

  1. (10 points) Suppose you have a self-aligning fingerprint tree for a string S and self-aligning fingerprint tree for T. Both S and T have at most n characters. Briefly describe how you would efficiently compute the fingerprint tree for the concatenation S+T. What is the running time and how many new nodes did you need to create (as big-O bounds)?
  1. (15 points) For the Byzantine general agreement protocol:

(a) Do all the good processors reach agreement in the same round? If not, how many steps does it take? Explain briefly.

(b) Suggest a modification to the Byzantine agreement program (the pseudo-code is given on the next page) so that all the processors halt after complete (good-processor) agree- ment is reached.