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
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
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, 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, 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 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, 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, 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 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
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
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(