final-2011-WinterKey

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 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
Background image of page 3

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

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

This note was uploaded on 03/21/2012 for the course CMPSC 40 taught by Professor Egiceoclu during the Spring '09 term at UCSB.

Page1 / 11

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

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online