CS 577: Introduction to Algorithms
11/02/06
Homework Solution: 3b
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
1a
Consider a boolean array A indexed from 0 to x. A(v ) = 1 indicates that we can make change for value v using the given denomina
CS 577: Introduction to Algorithms
12/05/06
Homework Solution: 5b
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
Note that Not-All-Equal-SAT (N AE -SAT ) is in NP. Say we have n boolean variables x1 to xn and m clauses C1 to Cm in CN F giving u
CS 577: Introduction to Algorithms
11/28/06
Homework Solution: 5a
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
The idea is to follow a clone of randomized quicksort. We have a set of nuts N and a set of bolts B. First we pick an element i of
CS 577: Introduction to Algorithms
11/09/06
Homework Solution: 4a
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
There can be multiple min-cuts in a ow graph. Let us denote the edges crossing a particular min-cut as M inCuti . From denition it
CS 577: Introduction to Algorithms
10/10/06
Homework Solution: 02
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
1a
See Figure 1, 2 and 3.
Figure 1: Vertex Cover
Figure 2: Vertex Cover
1b
The important observation for trees is that nodes connec
CS 577: Introduction to Algorithms
9/26/06
Homework Solution: 01
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
1a
First we prove that the matching R is a pairing then we show that it is in fact stable. The proof for both is by contradiction. F
CS 577: Introduction to Algorithms
Spring 2016
Homework 2 Review
Instructors: Eric Bach and Shuchi Chawla
TA: Kevin Kowalski
1. (Kleinberg-Tardos Ch 5, #2) Given a list of n numbers, define a significant inversion as a pair
i < j such that ai > 2aj . Show
HW3-
Question 1: Problem 15-1, page 404
Longest simple path is path which contains all the vertices of the graph without having a cycle.
lets assume we have L as a longest path in graph L from S to T and U is the next vertex in this
path, so we need to ki
HW4 March 1
1 - Exercise 16.1-4, page 422
S is set of n activities. A Greedy -activity-selector finds a maximum size set S1 of compatible activities which
are in S
We then will run the selector on S1 to find a maximum size set S2 , since we will include o
HomeWork2
Question1(Problem 9-1)
A)
We can use any optimal sorting algorithm, such as MergeSort, with running time: (n lg n)
B)
We will need to build a priority-queue as heap which will be (n), then calling Extract-Max i times (i log n)
would end up with
Problem Give a greedy algorithm that takes a dollar amount x and determines the way to represent x using as few U.S. coins as possible. Valid U.S. coins are quarters, dimes, nickels, and
pennies.
Solution Our algorithm will proceed by choosing as many qua
CS 577: Introduction to Algorithms
Out: 01/27/16
Homework 1
Due: 02/03/16
Ground Rules
This homework is for both sections of CS 577.
The homework consists of two questions. You are required to turn in detailed solutions for both. We will pick
one questi
CS 577: Introduction to Algorithms
Out: 02/03/16
Homework 2
Due: 02/10/16
Ground Rules
This homework is for both sections of CS 577.
The homework consists of two questions. You are required to turn in detailed solutions for both. We will pick
one questi
CS 577: Introduction to Algorithms
Homework 3
Out: 02/10/16
Due: 02/17/16
Ground Rules
See HW1.
Problems
1. (Restatement of problem 3.10 in the book.) Sometimes there are multiple shortest paths between pairs of nodes
in a graph. Develop an algorithm for
CS 577 Spring 2016
Practice Problems
TA: Benjamin Miller
1/25/16
1. Suppose we have three functions f (n), g(n), and h(n) such that f (n) O(h(n) and g(n)
O(h(n). Must it be the case that f (n) O(g(n)? Explain why or give a counterexample
showing why not.
CS 577: Introduction to Algorithms
Out: 02/24/16
Homework 5
Due: 03/02/16
Ground Rules
See HW1.
Both problems will be graded.
Problems
1. Imagine you are a summer intern at a large financial services company. To test your acumen, your boss gives
you the
CS 577: Introduction to Algorithms
Addendum to Homework 2
Addendum to Problem 1 on Homework 2
Here is an example to elucidate what problem 1 is asking for. Suppose that k = 3 and you are given the following
array A of size 4:
1
0
0
0
1
1
1
1
1
1
0
1
The b
CS 577: Introduction to Algorithms
Out: 03/02/16
Homework 6
Due: 03/09/16
Ground Rules
See HW1.
Both problems will be graded. Please submit each problem on a different sheet of paper.
For each DP-based algorithm, clearly provide: (1) the definition of
CS 577: Introduction to Algorithms
Out: 02/17/16
Homework 4
Due: 02/24/16
Ground Rules
See HW1.
Both problems will be graded.
Problems
1. A primary task for a typesetter is to break up text into lines so that each line is of roughly similar length. Supp
CS 577: Introduction to Algorithms
Out: 09/03/10 Ground Rules
Homework 0
Due: various dates
This is a self-calibration assignment. Some parts of the homework need to be turned in. The remaining are intended to be used to refresh your knowledge of the prer
CS 577: Introduction to Algorithms
9/12/06
Homework Solution: 00
Instructor: Shuchi Chawla
Question 1
1a
Our search strategy is to go (say) right one mile then come back to the start position and go right two miles then we return to the start position and
CS 577: Introduction to Algorithms
10/17/06
Homework Solution: 3a
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
The dynamic program is to ll an n V matrix M iteratively. Here M (i, j ) = w implies that using objects from the cfw_1, 2, ., i we
CS 577: Introduction to Algorithms
12/12/06
Homework Solution: 6a
Instructor: Shuchi Chawla TA: Siddharth Barman
Question 1
1a
Given an assignment of variables we can verify in polytime that the boolean formula is satised along with the fact that each var
(a)
Recur(n)
cfw_if n=4
divide n into 4 equal size: a,b,c,d
compare a and b
if a=b
compare b and c
if b=c
d defect
else c defect
else compare b and c
if b=c
a defect
else b defect
else
divide n into 4 equal size: a,b,c,d
compare
if a=b
c+d=n/2
recur(n/2)
_ Bank? (/9le Al'z/tmns (MA (Leta.
V
134 Selection and Adversary Arguments
L II.
1 2 3 4 5 6
Comment:
Comparison and result Loser links
L[2] > L) Inna l is on 2's loser list.
L[3] > L[4] nn 4 is on 3's loser list.
L[6] > us] an. 5 is on 6s loser list.
In
CS 577 Sections 1 and 2
Fall 2016
Homework #1
Due at beginning of class 9/21 and 9/22
Rules for Homework.
i.) Everyone must do his or her own work. Any sources beyond your class notes and
textbook must be cited. In any case, there must be significant valu
CS 577 Sections 1 and 2
Fall 2016
Homework #2
Due at beginning of class 10/5 and 10/6
Rules for Homework. See Homework 1.
1.
Consider the following task. Given a list of classes
(start1 ,size1 ), ., (startn ,sizen )
where starti is the starting time for c
CS 577 Sections 1 and 2
Fall 2016
Homework #5
Due at beginning of class 11/30 and 12/1
Rules for Homework. See Homework 1. Note that there are 3 problems on this homework.
1. In class we proved that the expected number of key comparisons done by Quicksort
CS 577 Sections 1 and 2
Fall 2016
Homework #4
Due at beginning of class 10/31 and 11/1
Rules for Homework. See Homework 1.
1.
Provide an algorithm for the following task. Given an array of real numbers A[1.n]
(with entries positive/zero/negative), output