CSEP 521
Applied Algorithms
Richard Anderson
Lecture 6
Dynamic Programming
Announcements
Midterm today!
60 minutes, start of class, closed book
Reading for this week
6.1, 6.2, 6.3., 6.4
Makeup le
Algorithms and Proofs
Algorithm: A sequence of instructions that unambiguously specify how
to solve a particular problem.
Proof: A sequence of assertions that unambiguously verify the
correctness of s
12
s
2
-2
b
1
1
4
2
e
2
a
-5
c
j
1
4
d
3
g
What about negative edge
weights?
-6
f
5
h
Assume no
negative cycles.
Claim: If graph has no negative length cycles, then
shortest walk between (s,v) has len
Intro: Coin Changing
Coin Changing
Goal. Given currency denominations: 1, 5, 10, 25, 100,
give change to customer using fewest number of coins.
Ex: 34.
Cashier's algorithm. At each iteration, give the
Analysis
How to reason about the performance of
algorithms
1
Defining Efficiency
Runs fast on typical real problem instances
Pro:
sensible, bottom-line-oriented
Con:
moving target (diff computers, co
More Dynamic
Programming
Common Subproblems
Opt(i) - Opt solution using x ,.,x . (eg LIS,
longest path).
1
i
Opt(i,j) - Opt solution using x ,.,x . (eg RNA)
Opt(i,j) - Opt solution using x ,.,x and
12
s
2
2
b
1
1
4
2
e
2
a
5
c
j
1
4
d
3
g
6
f
5
h
Given directed graph with non-negative edge
lengths lu,v. Compute all shortest paths from s to
every other vertex.
Disjkstra(s)
Set all vertices v undi
NP-completeness
Many many problems are NP-complete
If you solve one of them efficiently, you
solve all of them efficiently
We dont know how to solve any of them
efficiently
Approximation
Algorithms
CSE521: Design and Analysis of Algorithms
October 30, 2017
Midterm
Anup Rao
Due: November 8, 2017
Read the fine print1 . An algorithm is said to run in polynomial time if it runs in time O(nd )
for so
algorithm design techniques
Divide & Conquer
Reduce problem to one or more sub-problems of
the same type
Typically, each sub-problem is at most a constant
fraction of the size of the original problem
Plan
Dynamic Programming
2
Algorithmic Paradigms
Greed. Build up a solution incrementally, myopically optimizing some
local criterion.
Divide-and-conquer. Break up a problem into two sub-problems, sol
Graphs
3
Objects & Relationships
Facebook friends:
Obj: People
Rel: Two are related if they are friends
Cities and Roads:
Obj: Cities
Rel: Two are related if they have a road between them
Data flow in
Minimum Spanning Tree
Minimum spanning tree. Given a connected graph G = (V, E) with realvalued edge weights ce, an MST is a subset of the edges T E such
that T is a spanning tree whose sum of edge we
degrees
Claim: If a graph has m edges, then
deg(v) = 2m.
v
Proof: Every edge cfw_u,v contributes exactly 2 to the
left hand side, 1 to deg(u), and 1 to deg(v).
degrees
Claim: In a party, the number o
CSEP 521
Applied Algorithms
Richard Anderson
Winter 2013
Lecture 2
Announcements
Reading
Chapter 2.1, 2.2
Chapter 3
Chapter 4
Homework Guidelines
Prove that your algorithm works
A proof is a co
CSEP 521
Applied Algorithms
Richard Anderson
Lecture 7
Dynamic Programming
Announcements
Reading for this week
6.1-6.8
Review from last week
Weighted Interval Scheduling
Optimal linear interpolation
CSEP 521
Applied Algorithms
Richard Anderson
Winter 2013
Lecture 3
Announcements
Reading
For today, sections 4.1, 4.2, 4.4
For January 28, sections 4.5, 4.7, 4.8 (Plus
additional material from chap
CSEP 521
Applied Algorithms
Richard Anderson
Lecture 8
Network Flow
Announcements
Reading for this week
6.8, 7.1, 7.2 [7.3-7.4 will not be covered]
Next week: 7.5-7.12
Final exam, March 18, 6:30 p
CSEP 521
Applied Algorithms
Richard Anderson
Lecture 10
NP Completeness
Announcements
Reading for this week
Chapter 8. NP-Completeness
Final exam, March 18, 6:30 pm. At UW.
2 hours
In class (CSE
CSEP 521
Applied Algorithms
Richard Anderson
Lecture 9
Network Flow Applications
Announcements
Reading for this week
7.5-7.12. Network flow applications
Next week: Chapter 8. NP-Completeness
Final
CSEP 521
Algorithms
Divide and Conquer
Richard Anderson
With Special Cameo Appearance by
Larry Ruzzo
Divide and Conquer Algorithms
Split into sub problems
Recursively solve the problem
Combine solutio
CSE421: Design and Analysis of Algorithms
October 2, 2017
Homework 1
Anup Rao
Due: October 11, 2017
Read the fine print1 . Each problem is worth 10 points:
1. Assume have functions f, g such that f =
CSE521: Design and Analysis of Algorithms
October 11, 2017
Lecture Fast Fourier Transform
Lecturer: Anup Rao
1
Scribe:
Multiplying Polynomials via the Fast Fourier Transform
We are given two polynomia
CSE521: Design and Analysis of Algorithms
October 16, 2017
Homework 2
Anup Rao
Due: October 25, 2017
Read the fine print1 . Each problem is worth 10 points:
1. You are given two sorted lists of intege
12
s
2
2
b
1
1
4
2
e
2
a
5
c
j
1
4
d
3
g
6
f
5
h
Given directed graph with non-negative edge
lengths lu,v. Compute all shortest paths from s to
every other vertex.
Disjkstra(s)
Set all vertices v undi