Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 5
October 13, 1998
Solutions for Problem Set 1
Problem 1.
Fixed Point
Given a sorted array of distinct integers A with n entries, consider the problem of nding
an index i such that A[
Analysis of Algorithms, CSOR 4231.
Columbia University, Fall 2011.
Professor Cliord Stein.
Homework 2 - Solutions
Problem 1. Exercise 4.3.7. Recurrences with lower order terms.
If we were to try a straight substitution proof, assuming that T (n) cnlog3 4
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 2
September 21, 1998
Problem Set 1
This problem set is due in class on Monday, Oct 5.
Reading assignment:
24.
Chapter 16, 17 (Sections 13 only), 31 (Sections 12 only) and
Suggested ex
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 4
October 5, 1998
Problem Set 2
This problem set is due in class on Monday, Oct 19, except for CVN student who should
mail it by Wednesday, Oct 21.
Suggested exercises from CLR: 17.3-
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 8
October 22, 1998
Solutions for Problem Set 2
Problem 1. Repeated values
Solution
(a)
Algorithm description
The following algorithm determines whether there are indices i j i 6= j su
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 11
October 26, 1998
Practice Midterm
This is a closed book exam. You can only use one two-sided sheet of notes. No book, no
other notes, no calculator, no collaboration.
Read the ques
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 14
November 6, 1998
Solutions for Practice Midterm
Problem 1. Master Theorem
Solution
p
(a) T (n) = 2T (n=3) + c n.
So b = 3, a = 2, and nlogb = n 6309 .
f (n) = cpn = cn 5.
Therefore
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 14
November 9, 1998
Midterm
This is a closed book exam. You can only use one two-sided sheet of notes. No book, no
other notes, no calculator, no collaboration.
Read the questions car
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 15
November 16, 1998
Midterm Solutions
Problem 1.
Master Theorem
Here is a table of logarithms. In the row i and column j you nd the value of logi j .
2
3
4
5
1
log2 1 = 0
log3 1 = 0
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 7
October 19, 1998
Problem Set 3
This problem set is due in class on Monday, Nov 16, except for CVN student who should
mail it by Wednesday, Nov 18.
Suggested exercises from CLR: 12.2
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 18
November 30, 1998
Solutions for Problem Set 3
Problem 1.
Radix Tree
Solution
(a)
Below is pseduo-code for the three requested routines. These assume the existence of the
following
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 16
November 16, 1998
Problem Set 4
This problem set is due in class on Monday, Nov 30, except for CVN student who should
mail it by Wednesday, Dec 2.
Suggested exercises from CLR: 23.
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 22
December 15, 1998
Solutions for Problem Set 4
Problem 1. Strongly Connected Components
Solution
Statement (b) is true.
Strongly connected components of a directed graph, G, are sub
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout 19B
December 7, 1998
Problem Set 5B
This problem set is due in class on Monday, Dec 14, except for CVN student who should
mail it by Wednesday, Dec 16.
When a problem asks to give an
Columbia University
W4231: Analysis of Algorithms
Luca Trevisan
Handout new
New Handout
Solutions for Problem Set 5
Problem 1.
Edge Cover
Solution
(a) There are |M | edges in the matching and these edges cover 2 |M | vertices. There are
|V | 2 |M | vertic
CSOR 4231 Midterm Exam
Due: Thursday, November 3, 2011, 2:30PM in class.
Rules
You may consult the textbook, Introduction to Algorithms, 3rd edition by Cormen,
Leiserson, Rivest and Stein, your notes, the course website, any handouts from class,
a diction
Analysis of Algorithms, CSOR 4231.
Columbia University, Fall 2011.
Professor Cliord Stein.
Homework 4 - Solutions
1. Problem 15-2. Longest Palidromic Sequence.
An easy approach to solve this problem is to generate the reverse string rst
and then nd the lo
Exercise 5.4-1. 5.4-4. Birthday paradox variants.
How many people must there be in a room before the probability that someone has the same birthday
as you do is at least 1/2?
Dene
1
if person i has the same birthday as you
Xi =
0
otherwise
Then for every