



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The questions and solutions for the midterm exam of cs 70 (discrete mathematics and probability theory) course at the university of california, berkeley in fall 2004. The exam covers various topics such as number theory, induction, graph theory, rsa, polynomials, and berlekamp-welsh algorithm. The questions require the students to apply their knowledge of these topics to solve problems and prove statements.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




PRINT your name: , (last) (first)
SIGN your name:
PRINT your username on cory.eecs:
WRITE your section number (101 or 102):
Three sides of 8.5 by 11 sheet of notes is permitted. No calculators are permitted. Do all your work on the pages of this examination. If you need more space, you may use the reverse side of the page, but try to use the reverse of the same page where the problem is stated.
You have 110 minutes. The questions are of varying difficulty, so avoid spending too long on any one question.
Do not turn this page until the instructor tells you to do so.
CS 70, Fall 2004, Midterm 1 1
Circle TRUE or FALSE. There is no need to justify your answers on this problem.
(a) TRUE or FALSE: If the implication 6 P =โ Q is true, then 6 Q =โ P. True
(b) TRUE or FALSE: If A or B is true and B are true than A must be true.
(c) TRUE or FALSE: gcd ( n + 1 , 2 n + 1 ) = 1. True. Apply Euclidโs algorithm.
(d) TRUE or FALSE: For all n > 1, 2 n^ โ 1 is prime.
False. 24 โ 1 = 15 is not prime.
(e) TRUE or FALSE: For all odd n , gcd ( n , n โ 2 ) = 1. True. Assume n = ad and n โ 2 = a โฒ d , then n and n โ 2 must differ by at least d (or be the same number) but d cannot be 2.
(f) TRUE or FALSE: For all a , m , am โ^1 = 1 mod p. False. a = 0 for any m.
(g) TRUE or FALSE: For all a , m = pq , where p and q are prime, a ( p โ^1 )( q โ^1 )^ = 1 mod m.
False. a = 0 for any m.
(h) TRUE or FALSE: For all a , m = pq , where gcd ( a , m ) = 1 and p and q are prime, a ( p โ^1 )( q โ^1 )^ = 1 mod m
True. Fermatโs little theorem.
(i) TRUE or FALSE: 5 has an inverse mod 12? True. 5 is the inverse of 5 mod 12.
(j) TRUE or FALSE: The complete graph on n nodes is the graph where every pair of nodes is an edge. The complete graph on n nodes is Eulerian for n odd. True. The degree is n โ 1 which is even which implies that the graph is Eulerian.
CS 70, Fall 2004, Midterm 1 2
Prove that the complete graph on n nodes is Hamiltonian, for n โฅ 3.
Proof. A number of proofs work here. Here is one. The sequence of nodes 1,... n , is a hamiltonion cycle since every edge ( i , i + 1 ) and the edge ( n , 1 ) is present.
Here is another. A three node comlete graph is hamiltonian. Given that the n โ 1 node complete graph is hamiltonian, one can construct a Hamiltonian cycle in the n node complete graph by noting that removing a single node yields an n โ 1 node complete graph, forming a Hamiltonian cycle in that graph, and then inserting the new node at any point in the Hamiltonian cycle. The new path is hamiltonian since the new node is connected to its predecesser and successor.
CS 70, Fall 2004, Midterm 1 4
CS 70, Fall 2004, Midterm 1 5
Consider a message m 1 ,... , mn where each mi is a field element. Consider the degree n โ 1 polynomial P where P ( i ) = mi. Recall that knowing any n correct points on the polynomial allows us to reconstruct the polynomial.
CS 70, Fall 2004, Midterm 1 7