{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

final-2011-WinterKey

# final-2011-WinterKey - CS 40 Final Examination Department...

This preview shows pages 1–5. Sign up to view the full content.

CS 40: Final Examination Department of Computer Science University of California, Santa Barbara Closed-Book, 3 hours Winter 2011 Instructions Before you answer any questions, print your name and perm number. Read each question carefully. Make sure that you clearly understand each question before answering it. Put your answer to each question on its own page. You may wish to work out an answer on scratch paper before writing it on your answer page; answers that are difficult to read may lose points for that reason. You may not leave the room during the examination, even to go to the bathroom. You may not use any personal devices, such as calculators, PDAs, or cell phones. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1. (12 points) Define the following terms: P ( n, r ) (in terms of factorials) n ! ( n - r )! C ( n, r ) (in terms of factorials) ˆ n r ! = n ! r !( n - r )! Pascal’s Identity: ˆ n + 1 k ! = ˆ n k - 1 ! + ˆ n k ! Binomial Theorem: ( x + y ) n = n k =0 ˆ n k ! x n - k y k 2
2. (10 points) Give a recursive procedure C( int n, int k) for computing ˆ n k ! . A recursive procedure using Pascal’s identity follows: int C( int n, int k ) { assert n >= k && k >= 0; if ( k == 0 ) return 1; if ( k == 1 ) return n; return C( n - 1, k ) + C( n - 1, k - 1); } 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3. (5 points) DNA is composed of 4 bases: Adenine, Cytosine, Guanine, and Thymine. Assuming that, on
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern