CS 331 Design and Analysis of Algorithms
Project #1
(Due: 11/14/2013)
Program the following algorithms that we covered in the class:
a. Classical matrix multiplication
b. Divide-and-conquer matrix multiplication
c. Strassen's matrix multiplication
In orde
Fall 2013
CS 331 01 Design and Analysis of Algorithms
TuTh 1:00 p.m. - 2:50 p.m.
Room 3/2636
Instructor
Dr. G. S. Young
- Office
8/14
- Office Hours
Tu
W
Th
- Phone
- Email
4:50 7:00 p.m.
12:20 1:00 p.m
4:50 7:00 p.m.
Or by appointment
909-869-4413
gsyoun
CS 331 Design and Analysis of Algorithms
Homework #3
(Due: 11/21/2013)
Note: Turn in your homework with a cover sheet including your name and last 4 digits of your
student ID # so that your grade can be correctly recorded. Write on only one side of each p
CS331 Design and Analysis of Algorithms
Due date: March 6, 2017
Chapter 4: 2, 7, 9, 10, 13, 17,26, 27, 46
Winter 2017
Hw#5
2. Use Prims algorithm to find a minimum spanning tree for the following graph. Show the actions step by step.
7. Use Kruskals algor
CS 331 Design and Analysis of Algorithms
Project #2
(Due: 3/8/2016)
Given a list of n numbers, the Selection Problem is to find the k th smallest element
in the list. The first algorithm (Algorithm 1) is the most straightforward one, i.e. to sort
the list
CS 331-01 Design and Analysis of Algorithms
Homework #1
(Due: 10 AM, Thursday, 10/6/2016)
1. Find the total frequency count for all assignment statements in the following algorithm.
Do not include loop initialization and loop increment steps.
for i = 1 to
CS 331-01 Design and Analysis of Algorithms
Project #1
(Due: 11 PM, Thursday, 11/3/2015)
Implement the following algorithms:
a. Insertion Sort
b. Mergesort
c. Quicksort1 (Regular Quicksort)
d. Quicksort2 (Quicksort / Insertion Sort Combo)
e. Quicksort3 (R
CS 331-01 Design and Analysis of Algorithms
Homework #4
(Due: 10 AM, Thursday, 12/1/2016)
1. Given A=[20x2], B=[2x15], C=[15x40], and D=[40x4]. Compute the C(i,j)'s defined in
the class for all i < j and trace your computation to get the multiplication or
CS 331-01 Design and Analysis of Algorithms
Homework #3
(Due: 10 AM, Thursday, 11/3/2016)
1. Let G = (V,E) be an undirected graph. A node cover of G is a subset U of the vertex set
V such that every edge in E is incident to at least one vertex in U. A min
CS 331 Design and Analysis of Algorithms
Homework #2
(Due: 10/31)
Note: Turn in your homework with a cover sheet including your name and last 4 digits of your
student ID # so that your grade can be correctly recorded. Write on only one side of each page.
es
13
S
33 01
p
S l2
el
Cl
h
a
s
F
ct
e
oj
Pr
on
si
1
Outline
Handout project 2
Help with project 1
2
Project 2
Handout
Requirements
Find the kth smallest element of a list
Implement 3 different algorithms (4 actually)
1.
Straightforward, sort the list (m
CS 331 Design and Analysis of Algorithms
Homework #1
(Due: 10/17/2013)
Note: Turn in your homework with a cover sheet including your name and last 4 digits of your
student ID # so that your grade can be correctly recorded. Write on only one side of each p
CS 331 Design and Analysis of Algorithms
Homework #4
(Due: 12/5/2014)
(Total: 100 points)
1. (25 points)
Given A=[252], B=[220], C=[2010], and D=[105]. Compute the C(i,j)'s defined in
the class for all i < j and give the solution (i.e. the multiplication
Dynamic Programming
General Idea
Problem can be divided into stages with a policy decision
required at each stage. (Solution is a sequence of
decisions)
Each stage has a number of states associated with it.
The effect of the policy decision at each sta
NP-Completeness
Reference: Computers and Intractability: A
Guide to the Theory of NP-Completeness
by Garey and Johnson,
W.H. Freeman and Company, 1979.
Young
CS 331
D&A of Algo.
NP-Completeness
1
General Problems, Input Size and
Time Complexity
Time comp
CS331
Dr. Young
The Greedy Approach
Young
CS 331 D&A of Algo.
Greedy
1
General idea:
Given a problem with n inputs, we are required to obtain a
subset that maximizes or minimizes a given objective function
subject to some constraints.
Feasible solution an
CS331
Dr. Young
Introduction
1. Algorithms
2. Order
3. Analysis of Algorithm
4. Some Mathematical Background
Young
CS 331 D&A of Algo.
Topic: Introduction
1
What is an algorithm?
A simple, unambiguous, mechanical
procedure to carry out some task.
Why algo
CS 331
Dr. Young
Divide-and-Conquer
General idea:
Divide a problem into subprograms of
the same kind; solve subprograms using
the same approach, and combine partial
solution (if necessary).
Young
CS 331 D&A of Algo.
Topic: Divide and Conquer
1
1. Find the
CS 331 Design and Analysis of Algorithms
Project #2
(Due: 12/3/2013)
Given a list of n numbers, the Selection Problem is to find the kth smallest element
in the list. The first algorithm (Algorithm 1) is the most straightforward one, i.e. to sort
the list
CS 331-01 Design and Analysis of Algorithms
Homework #2
(Due: 10 AM, Thursday, 10/20/2016)
1. Solve the following recurrence relations and get the equivalent non-recursive definition
for T(n) in terms of n. Show steps. No credit will be given if you apply