CS 218, Fall 2012
Homework 2 Solution
Problem 1. (20 points)
In the algorithm Select described in class (linear time selection), the input elements
are divided in groups of 5. Write the recurrence relation for the time complexity of Select
if you decided
CS 218, Fall 2012
Homework 1 Solution
Problem 1. (30 points)
You are facing a high wall that stretches innitely in both directions. There is a door in
the wall, but you dont know how far away or in which direction. It is pitch dark, but you
have a very di
CS 218, Fall 2012
Homework 4 Solution
Problem 1. (20 points)
Suppose that we are given a set of n objects (initially each item in its own set) and we
perform a sequence of m Find-set, and Link operations, where all the Link operations
occur before any of
CS 218, Fall 2012
Homework 3 Solution
Problem 1. (20 points)
Let I1 , I2 , . . . , In be a set of intervals on the real line, with Ii = [ai , bi ]. Design an ecient
greedy algorithm to pick a minimum cardinality set S of points such that Ii S = for all
1
CS 218, Fall 2012
Posted: October 16, 2012
Homework 2
Due: October 30, 2012
Write on the rst page your full name with upper-case LAST name, assignment number, student
ID
You are expected to work on this assignment on your own. Include the following on r
CS 218, Fall 2012
Homework 1
Posted: October 2nd, 2012
Due: October 16th, 2012
Write on the rst page your full name with upper-case LAST name, assignment number,
student ID, login
You are expected to work on this assignment on your own. Include the foll
CS 218, Spring 2017
Homework 4
Posted: April 27, 2017
Due: May 4, 2017
The solution of this assignment has to be typed (LATEX works great)
Write on the first page your full name with upper-case LAST name, assignment number, and
student ID
You are expec
CS 218, Fall 2015
Homework 1 Solution
Problem 1. (30 points) Give a tight bound (using the big-theta notation) on the number
of His produced by the following method as a function of n. For simplicity, you can assume
n to be a power of two.
Algorithm Loopy
CS 218, Fall 2015
Homework 2 Solution
Problem 1. (30 points)
Using the Master method, give an asymptotic tight bound for T (n) dened by the following recurrence relation
2
n=2
2
n + log n n > 2
4T
T (n) =
Answer: Let n = 2k (that is, log2 n = k). Then
T (
CS 218
Design and Analysis of Algorithms
Homework 8
December 10, 2015
Problem 1
1. Given a ow network G = (V, E), we dene an edge e E to be upward critical if
increasing the capacity of e increases the value of the maximum ow. Does every network
have an u
CS 218
Design and Analysis of Algorithms
Homework 2
December 10, 2015
Problem 1
Using the Master Theorem, give an asymptotic tight bound for T (n) dened by the following
recurrence relation
2
n=2
T (n) =
4T ( n) + log2 n if n > 2
You will need to apply an
CS 218, Fall 2012
Homework 4
Posted: November 13th, 2012
Due: November 27th, 2012
Write on the rst page your full name with upper-case LAST name, assignment number, student
ID, login
You are expected to work on this assignment on your own. Include the f
CS 218, Fall 2012
Homework 5 Solution
Problem 1. (25 points)
Given a ow network G = (V, E), we dene an edge e E to be upward critical if increasing the capacity of e increases the value of the maximum ow. Does every network
have an upward-critical edge?
CS 218, Fall 2012
Homework 3
Posted: October 31st, 2012
Due: November 13th, 2012
Write on the rst page your full name with upper-case LAST name, assignment number, student
ID, login
You are expected to work on this assignment on your own. Include the fo
CS 218, Spring 2017
Homework 2 Solution
Problem 1. (30 points)
Using the Master method, give an asymptotic tight bound for T (n) defined by the following recurrence relation
(
T (n) =
2
n=2
2
n + log n n > 2
4T
Answer: Let n = 2k (that is, log2 n = k). T
CS 218, Spring 2017
Homework 1 Solution
Problem 1. (30 points) Give a tight bound (using the big-theta notation) on the number
of His produced by the following method as a function of n. For simplicity, you can assume
n to be a power of two.
Algorithm Loo
CS 218, Spring 2017
Homework 2
Posted: April 13th, 2017
Due: April 20th, 2017
The solution of this assignment has to be typed (LATEX works great)
Write on the first page your full name with upper-case LAST name, assignment number,
and student ID
You ar
CS 218, Spring 2017
Homework 3 Solution
Problem 1. (30 points)
Give a divide-and-conquer algorithm for multiplying two polynomials of degree n in time
O(nlog2 3 ).
Answer: Suppose the two polynomials we want to multiply are A(x) = a0 + a1 x + a2 x2 +
. .
CS 218, Spring 2017
Posted: April 6th, 2017
Homework 1
Due: April 13th, 2017
The solution of this assignment has to be typed (LATEX works great)
Write on the first page your full name with upper-case LAST name, assignment number,
and student ID
You are
CS 218, Spring 2017
Homework 5
Posted: April 4th, 2017
Due: April 11th, 2017
The solution of this assignment has to be typed (LATEX works great)
Write on the first page your full name with upper-case LAST name, assignment number, and
student ID
You are
CS 218, Spring 2017
Posted: April 20, 2017
Homework 3
Due: April 27, 2017
The solution of this assignment has to be typed (LATEX works great)
Write on the first page your full name with upper-case LAST name, assignment number, and
student ID
You are ex
CS 218, Spring 2017
Homework 4 Solution
Problem 1. (20 points)
In the algorithm Select described in class (linear time selection), the input elements
are divided in groups of 5. Write the recurrence relation for the time complexity of Select
if you decide
CS 218, Fall 2012
Posted: November 27th, 2012
Homework 5
Due: December 13th, 2012 (Final exam)
Write on the rst page your full name with upper-case LAST name, assignment number, student
ID, login
You are expected to work on this assignment on your own.
CS 218
Design and Analysis of Algorithms
Homework 3
December 10, 2015
Problem 1
Give a divide-and-conquer algorithm for multiplying two polynomials of degree n in time
3
O(nlog2 ).
Answer: Let, the two polynomials are
A(x) = a0 + a1 x + a2 x2 + + an xn
B(