ECE 606: Lecture 6
Dynamic Programming
Mark Crowley
October 26, 2015
Mark Crowley
ECE 606: Lecture 6
October 26, 2015
1 / 24
Todays Class
Announcements
Quiz 4 Hand back
Chapter 6 : Dynamic Programming
Quiz 5
Break
Chapter 6 : more Dynamic Programming
Mark
ECE 606 : Practice Homework 3
These questions from the Kleinberg text Chapter 3 will be useful practice for this Monday,
Oct 5s quiz.
1. See attached Excercise 2 in Kleinberg on page 106.
2. See attached Excercise 4 in Kleinberg.
These questions will be u
Algorithms: Analysis and Design
Mark Crowley
Department of Electrical and Computer Engineering
University of Waterloo
ii
c Mark Crowley
Acknowledgments
These notes are for the graduate course on Algorithms offered at the University of Waterloo. They close
ECE 606: Lecture 8
Chp 8: Complexity Classes
Mark Crowley
November 7, 2015
Mark Crowley
ECE 606: Lecture 8
November 7, 2015
1 / 25
Computational Complexity
Introduction
Optimization vs Decision Problems
Optimization problems
An optimization problem is one
Algorithms: Analysis and Design
Mark Crowley
Department of Electrical and Computer Engineering
University of Waterloo
ii
c Mark Crowley
Acknowledgments
These notes are for the graduate course on Algorithms offered at the University of Waterloo. They close
Algorithms: Analysis and Design
Mark Crowley
Department of Electrical and Computer Engineering
University of Waterloo
ii
c Mark Crowley
Acknowledgments
These notes are for the graduate course on Algorithms offered at the University of Waterloo. They close
Algorithms: Analysis and Design
Mark Crowley
Department of Electrical and Computer Engineering
University of Waterloo
ii
c Mark Crowley
Acknowledgments
These notes are for the graduate course on Algorithms offered at the University of Waterloo. They close
ECE 606 : Practice Homework 6
Here is the homework for this week to prepare for the next quiz. These are three questions
from the Kleinberg text. As always, also review the notes from class. Also think about
how Dynamic Programming, DP equations and the r
ECE 606 W2016 : Practice Homework 9
Here is the homework for this week to prepare for the quiz on Monday Dec 5 , 2016 based
on content from lectures 9 and 10. Think about the how youd answer the question on
your own first then check the hints on page two
ECE 606 : Practice Homework 2
CLRS refers to the second textbook Introduction to Algorithms 2nd Edition by
Cormen et al. Those pages are attached here but you can get see the whole text via the
library website by following the link from LEARN by clicking
Chapter 6
Dynamic Programming
Recall that greedy algorithms worked by making a sequence of myopic choices, without
worrying about the implications of those choices for the remaining subproblems. To prove
that a greedy algorithm does in fact nd the globall
ECE 606 : Quiz 4
First Name:
Last Name:
Student ID:
Date: October 19, 2015
E
E
3
2
2
1
C
1
C
3
Z
5
2
A
A
D
G
2
3
4
1
F
2
H
G
2
3
Z
5
D
4
1
4
4
B
2
B
F
2
H
Figure 1: A graph G, in directed and undirected forms.
1. (10 points) Considering the graph in gure
ECE 606 : Quiz 3
First Name:
Last Name:
Student ID:
Date: October 5, 2015
Full credit will only be given if answers are fully justied and clearly explained.
1. (5 points) In class, we saw how BFS can be used to determine whether there is a
path from a nod
ECE 606 : Quiz 2
Full Name:
Student ID:
Date: September 28, 2015
Answer the following questions :
1. (3 points) Is the following statement true or false? Explain why using the denition of (see reference on reverse side). 2n = (3n )?
Solution: False; 2n =
ECE 606 : Quiz 5
First Name:
Last Name:
Student ID:
Date: October 26, 2015
Make sure your nal answer is clearly indicated and all work is shown.
Reference: The Master Theorem
Let a 1 and b > 1 be constants, let f (n) be an asymptotically positive function
ECE 606 : Quiz 1
Full Name:
Date:
1. Consider the following preferences for a stable matching problem with three applicants and three companies. Each applicant and company submits their preference
list to the central job assigner, which then runs the Gale
ECE 606 : Practice Homework 5
So to practice some of concepts from this weeks lecture and prepare for Quiz 5 on Monday
here are some resources to look at. Recurrence relations and the Master Method are very
standard topics so there are lots of resources o
ECE 606 : Practice Homework 3
To practice thinking about graphs and proofs consider the following questions from the
Kleinberg text Chapter 3. Solutions are attached in order later in the pdf, but try to
solve them first yourself before looking at them :
Algorithms: Analysis and Design
Mark Crowley
Department of Electrical and Computer Engineering
University of Waterloo
ii
c Mark Crowley
Acknowledgments
These notes are for the graduate course on Algorithms offered at the University of Waterloo. They close
ECE 606: Lecture 6
Dynamic Programming
Mark Crowley
October 24, 2016
Mark Crowley
ECE 606: Lecture 6
October 24, 2016
1 / 30
Todays Class
Announcements
Chapter 6 : Dynamic Programming
Weighted Interval Scheduling
The Knapsack Problem
Shortest Path with ne
31 Rooted Trees
31.1 Definitions for Rooted Trees
DEFINITION: A tree is a set of nodes, perhaps empty. If not empty,
there is a distinguished node r, called root and zero or more sub
rees
T1,T2,.Tk each of whose roots are connected by a directed edge to
TB Schardl
September 25, 2009
6.046J/18.410J
Recitation 3
Deterministic Select
Problem: Given an unsorted set of n elements, nd the ith order statistic of that set (the ith
smallest element in the set.)
The obvious way to do this takes O(n log n) time. Th
Merger Sort
Merge Sort
This follows the divide and conquer approach in contrast to quick sort which is more akin to
conquer and divide. Merge sort divides the array and does the work of recombining (conquering)
the subparts afterwards whereas quick sort d