{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

final-2011-WinterKey

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

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern