Unformatted text preview:

U.C. Berkeley – CS70: Discrete Mathematics for Computer Science Problem Set 2Lecturer: Luca Trevisan Due February 6, 2007 at 2:30pmProblem Set 21. Simple Induction (5 pts)Prove that for every n ≥ 2,q1 +p1 + . . .√1 (n square roots) is irrational.2. Recursion and proofs (5 pts)Let the function, g, be defined on the natural numbers r e c ursively as follows: g(0) = 0, g(1) = 1, andg(n) = 5g(n − 1) − 6g(n − 2), for n ≥ 2.Prove that ∀n ∈ N, g(n) = 3n− 2n.3. Making big rocks into little rocks (5 pts)One day, you find a shady-looking flyer on Sproul that advertises an undergraduate research positionin the Stanfor d geology department. After you make your way down to the Fa rm, Dr. Hoover, theprofessor in charge, hands you the following assignment to keep you busy for the first year, complainingthat none of the Stanford undergrads have been able to help him:You are given a single large pile of pebbles to start w ith. Every day, you have pick one pile of pebblesand split it into two smaller piles any way you wish. Then, you have to count the number of pebblesin each of the two new piles you just crea ted (k and m), and write down the product k ×m in your labnotebook. Of cour se, over time, you end up with more and mor e piles which get smaller and smaller.You get to stop when each pebble is in its own pile. Once you stop, add up all the numbers you wrotedown and report them to Dr. Hoover. See Figure 1 for an example of the process.Convince Dr. Hoover (and his funding ag e ncy) that this1is a pointless exercise: no matter how yousplit the piles, your answer will come out to n(n−1)/2, where n is the number of p e bbles in the originalpile (which you can just count on the first day).4. Stable Marriage (aka s table matching)(a) (5 pts) For the following instance of the stable marriage problem:Man highest→lowest1 B A C2 C B A3 A C BTable 1: Men’s preference listWoman highest→lowestA 1 2 3B 2 3 1C 3 1 2Table 2: Women’s preference listi. List the rogue couples in the pairing (1, C), (2, B), (3, A).ii. List all the possible stable pairings (note that a s ingle run o f the algorithm from class willonly reveal one; there may be others).(b) (3 pts) Run the traditional propose and reject algorithm on the following example:Man highest→lowest1 A B C D2 B C A D3 C A B D4 A B C DTable 3: Men’s preference listWoman highest→lowestA 2 3 4 1B 3 4 1 2C 4 1 2 3D 1 2 3 4Table 4: Women’s preference list1The research assignment, not this homework problem!Day: Pile-splitting operation: Write down:Day 1: 3 × 2 = 6Day 2: 1 × 1 = 1Day 3: 1 × 2 = 2Day 4: 1 × 1 = 1Day 5: Total: 6 + 1 + 2 + 1 = 10Figure 1: An example rock procedure for Pr oblem 3 with n = 5. Bonus (0 pts): what are those


View Full Document

Berkeley COMPSCI 70 - Homework

Documents in this Course
Notes 1

Notes 1

12 pages

Note 2

Note 2

6 pages

Notes

Notes

6 pages

Notes

Notes

7 pages

Note 10

Note 10

8 pages

n20

n20

10 pages

n19

n19

10 pages

n18

n18

10 pages

n17

n17

6 pages

n16

n16

9 pages

n15

n15

10 pages

n14

n14

9 pages

n13

n13

6 pages

n12

n12

7 pages

n11

n11

6 pages

n10

n10

8 pages

n9

n9

5 pages

n8

n8

7 pages

n7

n7

8 pages

n6

n6

5 pages

n5

n5

8 pages

n4

n4

7 pages

n3

n3

10 pages

n2

n2

7 pages

n1

n1

5 pages

Load more
Download Homework
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?