CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Homework 4 - Solutions
Problem 1: After Storm Sandy leaves, the small town of New Town is undergoing an electricity
power shortage. To recover the electricity service in the town, the local el
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Homework 4
Searching for Paths on Graphs
Deadline: April 20, 11:59pm.
Available points: 110. Perfect score: 100.
Homework Instructions:
Teams: Homeworks should be completed by teams of student
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Homework 3
Dynamic Programming and Graph Search
Deadline: April 4, 11:59pm.
Available points: 110. Perfect score: 100.
Homework Instructions:
Teams: Homeworks should be completed by teams of s
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2013
Homework 3 Solutions
TITLE
Part A (20 points)
Problem 1:
Let Track 1 to have n points and track 2 to have m points. We need two tables, each one for
the Euclidean distances between every pair
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Homework 1 - Solutions
Asymptotic and Number Theoretic Algorithms
Part A (20 points)
1
Problem 1:
In each of the following situations indicate whether = O(g) or = (g) or = (g):
Note: The g n f
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2013
Homework 2 Solutions
Divide-and-Conquer Algorithms, Sorting Algorithms, Greedy Algorithms
Problem 1 [20 points]
The more general version of the Master Theorem is the following. Given a recurre
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Homework 1
Asymptotics and Number Theoretic Algorithms
Deadline: February 18, 11:59pm.
Available points: 120. Perfect score: 100.
Homework Instructions:
Teams: Homeworks should be completed by
Fall 2012
CS 344: #5 More comparison stu
Farach-Colton
Due by 5:00pm, Oct. 11.
1. The mode of an array is the most frequent element of the array. Give an
algorithm to nd the mode of an array. Analyze its complexity. As always,
the faster the algorithm, th
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Midterm Exam
Name:
Perfect score: 100 points - Available points: 112.
No notes or books are allowed.
A. Specify whether the following statements are true or false and argue why:
- For any pair
SEARCH ALGORzmMs r0541 GRAPHS
+APPHCATIONS
—}— IMPLE MENTAT ION {SS‘J‘ES
DFS
BF 5
DUKSTRA" GRAPHS W COMWJTEK 505-963 BASBC OPERA
EFFICIENCY
OF THE SAME WA?
TEONS RUN [WITH DIFFERENT
ump gammy
M31? MA } RM
DEHX) OW
max) 00'»)
OM) 0(6)
ON DiFFERENT REPRESEN
Chapter 3
Decompositions of graphs
3.1 Why graphs?
A wide range of problems can be expressed with clarity and precision in the concise pictorial
language of graphs. For instance, consider the task of coloring a political map. What is the
minimum number of
Sample Midterm 2, Course 344
November 16, 2015
Problem 1. (12 pts) Run Prims algorithm from Node 1 to determine the
minimum weight spanning tree of the graph.
2
4
7
8
1
1
6
6
20
5
7
2
5
10
4
7
3
1
7
3
4
2
8
List all of the nodes in the oder Prim nds them.
Dynamic Programming
Dynamic Programming
1
General Dynamic Programming
Technique
Applies to a problem that at first seems to require a lot
of time (possibly exponential), provided we have:
n
n
Subproblem optimality: the global optimal solution can be
de
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Practice Questions and Reading Material
The nal exam is cumulative and will include problems relating to all the lectures. Please go over
all three study guides. The current study guide includ
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Practice Questions and Reading Material
Note: The chapters and exercises from the books are provided as supportive references for the
material covered during the lectures.
Greedy Algorithms: H
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Practice Questions and Reading Material
Note: The material from the books is provided as a supportive reference for the material covered
during the lectures.
Introduction to Concepts of Algori
CS 344: DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS
SPRING 2014
Midterm Exam
Name:
Perfect score: 100 points - Available points: 112.
No notes or books are allowed.
A. Specify whether the entire following statements are true or false and argue why:
- A dyn
Fall 2012
CS 344: #4 Trees and Whatnot
Farach-Colton
Due by 5:00pm, Oct. 4.
1. Prove that a forest consisting of k trees with a total of n nodes has n k edges.
(20 points)
2. Let G = (V, E, W ) be a weighted graph such that no two dierent edges in E
have
Fall 2012
CS 344: #3 Sorting
Farach-Colton
Due by 5:00pm, Sept. 27.
1. The merge algorithm presented in class was not in place. Assume you are given
an array A[1], ., A[n] where A[1], ., A[k ] is one sorted list and A[k + 1], ., A[n]
is another sorted lis
Inequalities
The term inequality is applied to any statement involving one of the symbols <, >,
,.
Example of inequalities are:
i.
ii.
iii.
iv.
x1
x + y + 2z > 16
p2 + q2 1/2
a2 + ab > 1
Fundamental Properties of Inequalities
1.
If a b and c is any real n
Direct-address table
If the keys are drawn from the reasoning small universe U = cfw_0, 1, . . . , m-1 of keys,
a solution is to use a Table T[0, . m-1], indexed by keys. To represent the dynamic set,
we use an array, or direct-address table, denoted by T
Greedy algorithms are simple and straightforward. They are shortsighted in their
approach in the sense that they take decisions on the basis of information at hand
without worrying about the effect these decisions may have in the future. They are
easy to
Graph Theory is an area of mathematics that deals with following types of problems
Connection problems
Scheduling problems
Transportation problems
Network analysis
Games and Puzzles.
The Graph Theory has important applications in Critical path analysis, S
If the allocated space for the table is not enough, we must copy the table into larger
size table. Similarly, if large number of members erased from the table, it is good idea
to reallocate the table with a smaller size. Using amortized analysis we shall