Instructions:
The questions are divided into three groups. You have to answer all questions in Groups 1
and 2 and exactly two questions in Group 3. In the above table, put check marks in the
small boxes beside the ques
Instructions:
The questions are divided into three groups. You have to answer all questions in Groups 1
and 2 and exactly two questions in Group 3. In the above table, put check marks in the
small boxes beside the ques
CSCI 3110 Assignment 8 Solutions
1. You are given a string of n characters s[1 . . . n], which you believe to be a corrupted
text document in which all punctuation has vanished (so that it looks something like
itwasthebestoftimes. . . ). You wish to recon
Ques. For the given dataset of e-commerce domain, you need to devise weighted ranking algorithm
for given products (defined by product_id) and come up with 5 top products based on assumption that
profit for company is primary objective. Please summarize y
Assignment 8
CSCI 3110: Design and Analysis of Algorithms
Due July 13, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not
Assignment 9
CSCI 3110: Design and Analysis of Algorithms
Due July 20, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not
Assignment 7
CSCI 3110: Design and Analysis of Algorithms
Due July 6, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 3
CSCI 3110: Design and Analysis of Algorithms
Due June 5, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 6
CSCI 3110: Design and Analysis of Algorithms
Due June 22, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not
Assignment 5
CSCI 3110: Design and Analysis of Algorithms
Due Jun 15, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 10
CSCI 3110: Design and Analysis of Algorithms
Due Dec 4, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 2
Sample Solution
CSCI 3110 Fall 2015
(a) First some notation. Let Tv be the subtree of T containing v and all its descendants. Let |Tv | be
the number of nodes in Tv . Heres the basic idea: Let r be the root of T and let v1 , v2 , . . . , vk b
Assignment 4
CSCI 3110: Design and Analysis of Algorithms
Due Oct 16, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 2
CSCI 3110: Design and Analysis of Algorithms
Due Oct 2, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not be
Assignment 3
Sample Solution
CSCI 3110 Fall 2015
(a) Let C1 , C2 , . . . , Cn denote the n classes and let I1 , I2 , . . . , I n be their time intervals. For each interval I j ,
we use s j and e j to denote its starting and ending times, respectively. We
Sample Solution
CSCI 3110 Assigment 1
Summer 2015
(a) The simplest input consists of a man and a woman who would rather stay single than be married to
each other. Formally, we have a man m1 and a woman w1 with preference lists cfw_w1 and cfw_m1 ,
respect
Assignment 10
CSCI 3110: Design and Analysis of Algorithms
Due July 27, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not
Assignment 3
CSCI 3110: Design and Analysis of Algorithms
Due May 29, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 2
CSCI 3110: Design and Analysis of Algorithms
Due May 25, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Assignment 1
CSCI 3110: Design and Analysis of Algorithms
Due May 15, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b
Sample Solution
Assignment 8
CSCI 3110 Summer 2015
I present two solutions here, one based on answering part (a), nding the set H, and then testing for
each element in H whether it is a heavy hitter; the other based on a much more direct approach. As it
t
Sample Solutions
Assigment 9
CSCI 3110 Summer 2015
a. As stated in the assignment, we represent a reghting strategy as a set S of pairs (i, v) such that we
place a reghter on node v in turn i. To develop a recurrence, we observe the following optimal
subs
Sample Solution
Assignment 10
CSCI 3110 Summer 2015
In 2-d, dominance reporting is a special case of 3-sided range reporting: A data structure that can answer
3-sided range queries with query ranges [l, r] [b, ) can easily be adapted to answer range queri
Sample Solutions
Assigment 6
CSCI 3110 Summer 2015
Heres the general strategy. Let S0 be the set of intervals not yet covered by intervals in S . Since
initially S = , we have S0 = S. Now we repeat the following procedure until S0 is empty, that is,
all i
Sample Solutions
Assignment 7
CSCI 3110 Summer 2015
Question 1
(a) T (n) = 8T (n/2) + n2 . In the language of the Master Theorem, a = 8, b = 2, so log b a = log2 8 = 3.
f (n) = n2 = nlog2 8 for
= log2 8 2 > 0. Thus, T (n) (nlog2 8 ) = (n3 ).
(b) T (n) = 3
Sample Solution
CSCI 3110 Assignment 3
Summer 2015
I present three possible solutions here. The rst one uses a detour via an adjacency matrix, which is easy
but means that the best running time we can prove is O(nm) and that the algorithm uses (n2 ) space
Assignment 5
Sample Solutions
CSCI 3110 Summer 2015
1
The Algorithm
We represent every person Pi by two vertices bi and di representing their times of
birth and death, respectively. Since it is better for Pi to be born before he or she
dies, we also requi
Assignment 4
Sample Solutions
CSCI 3110 Summer 2015
We start by modeling the problem as a graph problem. We dene a graph G whose vertices
represent your friends. If x wants to be on the same team with y, we add a directed blue edge
from x to y. If x wants
Sample Solution
Assignment 2 CSCI 3110
Summer 2015
Question 1
(a) First observe that the function f (n) = 8n2 5n + 12 n 10n lg n is well-dened only for n > 0, so
we impose n 1 as an initial constraint. Under this assumption, we have
8n2 5n + 12 n 10n lg n
Sample Solutions
Assignment 8 CSCI 3110
Fall 2015
I present two different solutions, both equally acceptable. The first one is the dynamic-programming
solution I had in mind initially. The second one is a greedy algorithm. The first solution is the one
yo
Assignment 3
CSCI 3110: Design and Analysis of Algorithms
Due Oct 9, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not be
Sample Solution
Assignment 7
CSCI 3110 Fall 2015
We use the following adaptation of Quick Sort. Let p be the pivot chosen to partition the input. We
partition S into three sets: L := cfw_x S | x < p, M := cfw_x S | x = p, and R := cfw_x S | x > p. If HS
d
Assigment 5
Sample Solutions
CSCI 3110 Fall 2015
Note: In the interest of mathematical correctness, I spell out what a simplified recurrence T (n) = f (n)
means:
T (n) =
(1)
n < n0
f (n)
n n0
,
for an appropriate n0 . In the following answers, n0 refers
Assignment 8
CSCI 3110: Design and Analysis of Algorithms
Due Nov 20, 2015
Banner ID:
Name:
Banner ID:
Name:
Banner ID:
Name:
Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will
not b