CMPT 405/705 Design and Analysis of Algorithms Exercises on Dynamic Programming. 15th (at the beginning of the class) Due: Thursday, October
Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be explici
CMPT 405 Design and Analysis of Algorithms Outline Solutions to Exercises on Dynamic Programming
1. The residents of the underground city of Zion defend themselves through a combination of kung fu, heavy artillery, and efcient algorithms. Recently they ha
CMPT 405 Design and Analysis of Algorithms Outline Solutions to Exercises on Divide and Coquer
1. You are interested in analyzing some hard-to-obtain data from two separate databases. Each database contains n numerical values so there are 2n values total
CMPT 405/705 Design and Analysis of Algorithms Exercises on NP-Completeness. Due: Thursday, November 12th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration and consulting outside resources must be explicitly
CMPT 405/705 Design and Analysis of Algorithms Exercises on Flow Networks. Due: Thursday, November 5th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration and consulting outside resources must be explicitly me
CMPT 405/705 Design and Analysis of Algorithms Outline Solutions to Exercises on Dynamic Programming and Network Flow
1. Suppose that you are given an n n checkerboard and a checker. You must move the checker from the bottom edge of the board to the top e
CMPT 405/705 Design and Analysis of Algorithms Outline Solutions to Exercises on Graphs and Greedy Algorithms
1. Consider the problem of making change for n cents using the fewest number of coins. Assume each coins value is an integer. (a) Describe a gree
CMPT 405/705 Design and Analysis of Algorithms Exercises on Graphs and Greedy Algorithms. September 24th (at the beginning of the class) Due: Thursday,
Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must
Algorithms Dynamic Programming
Dynamic Programming II
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Dynamic Programming
7-2
Shortest Path
Suppose that every arc e of a digraph G has length (or cost, or weight, or ) len(e) But now we allow ne
Dynamic Programming
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Dynamic Programming
6-2
Knapsack
The Knapsack Problem Instance: A set of n objects, each of which has a positive integer value vi and a positive integer weight wi . A weight l
Algorithms Divide and Conquer
Divide and Conquer II
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Divide and Conquer
5-2
Counting Inversions
Comparing two rankings A ranking is a permutation of some objects Objects can be numbered, and one o
Divide and Conquer
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Divide and Conquer
4-2
Divide and Conquer, MergeSort
Recursive algorithms: Call themselves on subproblem Divide and Conquer algorithms: Split a problem into subproblems (divide
Dijkstras Algorithm
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Dijkstras Algorithm
3-2
Shortest Path
Suppose that every arc e of a digraph G has length (or cost, or weight, or ) len(e) Then we can naturally define the length of a directed
Algorithms Sequence Alignment
Sequence Alignment II
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Sequence Alignment
9-2
Alignments
Let X = x1, x2 ,K, xm and Y = y1 , y2 ,K, yn be two strings A matching is a set of ordered pairs, such that a
Algorithms Flows and Cuts
Flows and Cuts
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Flows and Cuts
10-2
Flows and Flow Networks
A flow network is a digraph with a unique source and sink nodes Arcs have capacities A flow is a function f: E
Algorithms Matchings
Matchings
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Matchings
11-2
Matchings
A matching M of a graph G = (V,E) is a set of edges such that every vertex is incident to at most one edge from M Bipartite graphs: biparti
Algorithms Demands and Bounds
Demands and Bounds
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Demands and Bounds
12-2
Demands
In our flow network model there is only 1 source and sink Can we do something for several sources and sinks? More
Airline Scheduling
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Airline Scheduling
13-2
The Problem
An airline carrier wants to serve certain set of flights Example:
Boston (6 am) - Washington DC (7 am), San Francisco (2:15pm) - Seattle (3:
NP
Design and Analysis of Algorithms Andrei Bulatov
Algorithms NP
14-2
Problems and Algorithms
We can encode any combinatorial problem as a binary string The length of a string s is denoted by |s| A decision problem X is the set of strings on which the an
NP-Completeness
Design and Analysis of Algorithms Andrei Bulatov
Algorithms NP-Completeness
15-2
NP-Completeness
What are the most difficult problems in NP? A problem X is said to be NP-complete if (i) X NP (ii) for any Y NP, we have Y X Lemma If an NP-co
PSPACE
Design and Analysis of Algorithms Andrei Bulatov
Algorithms PSPACE
16-2
Games
Geography. Amy names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Amy and Bob repeat this game until one
CMPT 405/705 Design and Analysis of Algorithms Exercises on Divide and Conquer. Due: Thursday, October 8th (at the beginning of the class)
Reminder: the work you submit must be your own. Any collaboration and consulting outside resourses must be explicite
CMPT 405/705 Design and Analysis of Algorithms Exercises on Dynamic Programming and Flow Networks. Thursday, October 22th (at the beginning of the class) Due:
Reminder: the work you submit must be your own. Any collaboration and consulting outside resours
Algorithms Sequence Alignment
Sequence Alignment
Design and Analysis of Algorithms Andrei Bulatov
Algorithms Sequence Alignment
8-2
The Sequence Alignment Problem
Question: How similar two words are? Say ocurrance and occurrence They are similar, because