CS106X
Handout 27S
February 5th, 2011
Winter 2011
CS106X Midterm Examination Solution
Thanks to the herculean efforts of a dedicated TA and seven wonderful section leaders, your
exams are graded and sitting outside my Gates 192 office door. Ill bring them
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 7
Counting practice
You can leave your answers as (tidy) expressions involving factorials, binomial coecients, etc.,
rather than evaluating them as decimal numbers.
1. How many
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 7
Counting practice
You can leave your answers as (tidy) expressions involving factorials, binomial coecients, etc.,
rather than evaluating them as decimal numbers.
1. How many
p
CS106X Winter 2008
Handout 29
CS106X Midterm Examination
February 19, 2008
This is an opennote, openbook, opencoursereader exam. You can refer to any course handouts, handwritten lecture notes, and printouts of any code relevant to a CS106
Programming Methodology and Abstractions (Accelerated)
CS 106X

Winter 2011
CS107
J Zelenski
Handout #4
May 2, 2011
Solutions to midterm practice
Midterm Exam: Friday, May 6th 11am12:15pm
Nvidia Auditorium (if your last name begins with AL)
Cubberly Auditorium (if your last name begins with MZ)
Be sure to come to the correct l
Programming Methodology and Abstractions (Accelerated)
CS 106X

Winter 2011
CS107
J Zelenski
Handout #3
April 29, 2011
Midterm practice
Midterm Exam:
Friday, May 6th 11am12:15pm
Nvidia Auditorium (if your last name begins with AL)
Cubberly Auditorium (if your last name begins with MZ)
SCPD students: Local SCPD students attend
CS106X
Handout 30
February 16th, 2011
Winter 2011
Assignment 5: Huffman Encoding
Assignment was pulled together by Owen Astrachan (of Duke University)
and polished by Julie Zelenski.
Huffman encoding is an example of a lossless compression algorithm that
CS106X Winter 2008
Handout 37
CS106X Practice Final
March 13, 2008
Exam Facts: When: Friday, March 21st at 8:30 a.m. in 260113 When: Friday, March 21st at 3:30 p.m. in Gates B03 You can take the exam at either time, regardless of conflict or not
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Discussion Section 2
Bad Proofs
Consider the following false statement and its (necessarily!) erroneous proof.
Theorem 1 2=1.
Proof: Take any a, b N = cfw_0, 1, 2, . . . such that a =
Chapter 10
Storage Management
[These notes are slightly modified from notes on C storage allocation from the Fall 1991 offering of CS60C. The language used is C, not Java.]
10.1
Classification of storage
In languages like C or Java, the storage used by a
CS70 Discrete Mathematics for Computer Science, Spring 2013
Section 1
1. Use truth tables to show that (A B ) A B and (A B ) A B . These two equivalences
are known as DeMorgans Law.
2. Which of the following statements is/are true? (In the following, Q(n)
GDB QUICK REFERENCE
GDB Version 5
Essential Commands gdb program [core] debug program [using coredump core] b [le:]function set breakpoint at function [in le] run [arglist] start your program [with arglist]
bt p expr c n s
backtrace: display program stack
inst.eecs.berkeley.edu/~cs61c
UCB CS61C : Machine Structures
Lecture 11 Introduction to MIPS
Procedures II & Logical Ops
Sr Lecturer SOE
Dan Garcia
20130215
Prof Paul Debevec (UC Berkeley PhD 1996) at
USC has been working to create virtual
humans to kee
GDB Tutorial
A Walkthrough with Examples
CMSC 212  Spring 2009
Last modied March 22, 2009
GDB Tutorial
What is gdb?
GNU Debugger A debugger for several languages, including C and C+ It allows you to inspect what the program is doing at a certain point du
CS61C Spring 2013
Section 4 (Video Notes)
MIPS Procedures
Overview:
There are only two instructions necessary for creating and calling functions: jal
and jr. If you follow register conventions when calling functio
CS61C Spring 2013
Section 4 (Video Notes)
MIPS Procedures
Overview:
There are only two instructions necessary for creating and calling functions: jal
and jr. If you follow register conventions when calling functio
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 4
Set Theory and Logic
A set is a collection, or family, of objects called elements.
Two sets are equal if they contain the same elements.
We can make new sets out of other set
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
Section 4
1. (a) What is the inverse of 5 modulo 7?
(b) Do the following numbers have inverses modulo 3580225?
5, 16, 10
Give a short explanation for each.
2. (a) Solve the following sys
Section 4 Brief Solutions
1) a) 3  use extended gcd or by inspection
b) N, Y, Y  only numbers that are coprime with 3580225 have inverses
2) a) x = 8, y = 5  multiply the second equation by 5, subtract the equations, solve for y,
substitute the value o
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 14
AC Transit
You arrive at the bus stop at a uniformly distributed random time in the morning.
1. The 51B comes by this stop exactly every 15 minutes, and its the only bus lin
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 14
AC Transit
You arrive at the bus stop at a uniformly distributed random time in the morning.
1. The 51B comes by this stop exactly every 15 minutes, and its the only bus lin
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 13
Carpets
The length of a carpet produced by a textile mill is uniformly distributed between 20 feet and 25
feet, while the width is uniformly distributed between 15 feet and
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 13
Carpets
The length of a carpet produced by a textile mill is uniformly distributed between 20 feet and 25
feet, while the width is uniformly distributed between 15 feet and
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 12
Joint distribution
Mr and Mrs Brown decide to continue having children until they either have their rst girl or until
they have ve children. Assume that each child is equall
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 12
Joint distribution
Mr and Mrs Brown decide to continue having children until they either have their rst girl or until
they have ve children. Assume that each child is equall
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 11
Indicator Variables.
Denition. An indicator variable for an event A is a random variable 1A : cfw_0, 1, such
that for all :
1 A
1A ( ) =
.
0 A
Let 1A be the indicator r.v. f
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
1
Section 11
Indicator Variables.
Denition. An indicator variable for an event A is a random variable 1A : cfw_0, 1, such
that for all :
1 A
1A ( ) =
.
0 A
Let 1A be the indicator r.v. f
CS 70
Discrete Mathematics and Probability Theory
Fall 2012
Vazirani
Section 10
1. A roll of the dice
Consider a single roll of two dice, one red and one blue.
(a) Let R be the value of the red die. What is the distribution of R? What is the expectation
o