15-251 Assignment 1
Page 1 of 10
15-251 : Great Theoretical Ideas In Computer Science
Fall 2013
Assignment 1
SOLUTIONS
15-251 Assignment 1
Page 2 of 10
1. Pancakes with Problems
(20)
(a) Suppose we have a special spatula which only lets us ip an even numb
15-251
Great Theoretical Ideas
in Computer Science
15-251
Proof Techniques for
Computer Scientists
Lecture 2
January 19, 2012
Induction
Inductive Reasoning
Dominoes
n dominoes numbered 0 to n-1
Domino Principle:
Line up any number of
dominos in a row; kno
15-251
Great Theoretical Ideas
in Computer Science
Tuesday, February 14, 12
Recurrences
Lecture 9 (February 13, 2012)
Adam Blank
Tuesday, February 14, 12
Announcements
Tuesday, February 14, 12
Announcements
You are now breathing manually
Tuesday, February
Great Theoretical Ideas In Computer Science
R. ODonnell
D. Sleator*
CS 15-251
Lecture 8
February 9, 2012
Spring 2012
Counting II: Pascal, Binomials, and
Other Tricks
(
+
+
Plan
Carnegie Mellon University
)(
+
)=?
Pirates and Gold
Pigeonhole Principle
Pasc
Great Theoretical Ideas In Computer Science
R. ODonnell
D. Sleator
Lecture 6
CS 15-251
February 2, 2012
Spring 2012
Carnegie Mellon University
Mathematical Games II
Sums of Games
+
4 2=6
This is a Brunnian Link, which shows how one loop of
rope and five r
15-251: Great Theoretical Ideas in Computer Science
Lecture 19
Linear algebra is about vectors.
Linear Algebra
Concretely, vectors look like this:
They are lists of numbers.
fig. by Peter Dodds
# of numbers, m, is called the dimension.
In linear algebra,
Random Walks
Geometric(p) r.v.
Lecture 20 (March 29, 2012)
Z = Number of flips with bias-p coin
until you see a heads
Sleator* , ODonnell
E[Z] = 1/p
For unbiased coin (p = ),
expected value = 2 flips
Abstraction of Student Life
Random Walks:
or, how to wa
Great Theoretical Ideas In Computer Science
R. ODonnell
D. Sleator
Lecture 5
CS 15-251
Jan 31, 2012
Spring 2012
Plan
Carnegie Mellon University
Mathematical Games I
Introduction to
Impartial Combinatorial Games
The Beer Can Game
Players alternate
placing
15-251: Great Theoretical Ideas in Computer Science
Lecture 3
Axiomatic Systems
and
Logic
Know this cold.
Part 2: Propositional logic.
Know this cold.
Part 3: First order logic.
Part 1: Axiomatic systems.
Get the basics.
An ATM has $2 bills and $5 bills
W
2/23/12
Graph informal definitions
Graphs I:
Trees and Planar Graphs
Lecture 12 (February 23, 2012)
Danny Sleator
More terms
Cycles
Acyclic
Paths
Connected
The degree of a vertex
Directed: an edge is an ordered pair of vertices
Undirected: edge is unorder
2/28/12
Ryan ODonnell
Danny Sleator *
15-251
Great Theoretical Ideas in
Computer Science
Graphs II
Lecture 13, February 28, 2012
Cayleys Formula
Recap
A graph is planar if
it can be drawn in the
plane without
crossing edges
The number of labeled trees
on
15-251
Great Theoretical Ideas
in Computer Science
Divisibility:
An integer a divides b (written a|b)
if and only if there exists an
Integer c such that c*a = b.
Primes:
A natural number p 2 such that
among all the numbers 1,2p
only 1 and p divide p.
Grea
2/7/12
Great Theoretical Ideas In Computer Science
Ryan ODonnell
Danny Sleator *
Lecture 7
CS 15-251
February 7, 2012
Spring 2012
Carnegie Mellon University
Counting I: Choice Trees and
Correspondences
If I have 14 teeth on the top and
12 teeth on the bot
15-251: Great Theoretical Ideas in Computer Science
Random Variables
Lecture 11
Probability 2
Definition 1:
A random variable is a variable,
in some randomized code.
Of type real number.
(Better to say its the variables value at
the end of an execution.)
Lecture 14, March 1, Spring 2012
Danny Sleator*
Ryan ODonnell
15-251
Great Theoretical Ideas
in Computer Science
Computing Maximum Matchings
The Stable Marriage Problem
Bipartite Graph
Recall: A graph is bipartite if the nodes V
can be partitioned into tw
15-251
Administrative details
Great Theoretical Ideas
in Computer Science
Course Staff
TAs
Prof. Ryan ODonnell
Prof. Danny Sleator
A:
B:
C:
D:
E:
F:
G:
JD Nir
Tim Wilson
Mark Kai
Adam Blank
Sang Tian
Jasmine Peterson
Andrew Audibert
Shashank Singh
Office
15-251: Great Theoretical Ideas in Computer Science
Lecture 10
7
Probability 1
1
7
A
1
5
7
3
3
3
9
9
5
5
5
7
3
B
5
5
8
8
2
8
2
C
2
D
France, 1654
Antoine Gombaud,
AKA Chevalier de Mr
Lets bet:
I will roll a die four times.
I win if I get a 1.
(not actuall
15-251: Great Theoretical Ideas in Computer Science
Lecture 4
Proofs
2.
What is a proof?
1.
How do I find a proof?
3. How do I write a proof?
2.
What is a proof?
1.
How do I find a proof?
The Aha! Moment
3. How do I write a proof?
I look at a problem, and
15-251: Great Theoretical Ideas in Computer Science
Lecture 18
Polynomials
Polynomials like to live in fields.
What is a field?
Fields
Find out about the wonderful world of
where two equals zero, plus is minus,
and squaring is a linear operator!
Rich Sch
Raising numbers to powers,
Cyrptography and RSA,
15-251
Great Theoretical Ideas
in Computer Science
Proof that Euclid is correct (review)
Euclid(A,B)
If B=0 then return A
else return Euclid(B, A mod B)
Let G = cfw_g | g|A and g|B
The GCD(A,B) is the maxim