CSC 373 H1
Quiz # 12 Solutions
29 November 2012
Note: This le contains sample solutions to the quiz together with the marking scheme and comments
for each question. Please read the solutions and the marking schemes and comments carefully. Make sure
that y
CSC 373 H1
Aids Allowed : none
Quiz # 12
Worth: 1.5%
29 November 2012
Duration: 10 minutes
Warning! This quiz involves a lot of reading, but only a little bit of writing.
Suppose you want to transfer a number of songs to CDs, using as few CDs as possible
CSC 373
Homework Assignment # 2
Worth: 7.5%
Fall 2012
Due: Before 10pm on Tuesday 23 October.
Remember to write the full name, student number, and CDF/UTOR email address of each group
member prominently on your submission.
Please read and understand the p
CSC 373 H1
Fall 2012
Homework Assignment # 3 Sample Solutions
1. (a) ExactCycle NP: On input (G, k, c), where c is a list of vertices, verify that c contains exactly k
vertices and that G contains every edge from one vertex in c to the next, and also from
CSC 373
Fall 2012
Homework Assignment # 1 Sample Solutions
1. (a) Order the requests by nonincreasing client time, i.e., so that ci1
This takes time (n log n), for sorting.
ci2
.
cin .
(b) We introduce some notation to make the proof easier to write. For
CSC 373
Fall 2012
Homework Assignment # 2 Sample Solutions
1. We give a dynamic programming algorithm.
Step 0: Describe the recursive structure of subproblems.
Consider an input E = f (e1 , e2 , . . . , en ). Note that if any ei is a variable, then it ha
CSC 373  Algorithm Design, Analysis, and Complexity
Summer 2014
Assignment 4: Due Friday August 9, Noon
Please follow the instructions provided on the course website to submit your assignment. You
may submit the assignments in pairs. Also, if you use any
CSC 373
Fall 2012
Homework Assignment # 4
Worth: 7.5%
Due: Before 10pm on Tuesday 4 December.
Remember to write the full name, student number, and CDF/UTOR email address of each group
member prominently on your submission.
Please read and understand the p
CSC 373  Algorithm Design, Analysis, and Complexity
Summer 2014
Assignment 2: Due Wednesday June 25, Midnight
Please follow the instructions provided on the course website to submit your assignment. You
may submit the assignments in pairs. Also, if you u
CSC 373 H1
Midterm Test
29 October 2012
Duration: 50 minutes
Aids Allowed: one single sided hand written 8.511 aid sheet
Student Number:
Last (Family) Name(s):
First (Given) Name(s):
Do not turn this page until you have received the signal to start.
In t
CSC 373
Homework Assignment # 4 Sample Solutions
Fall 2012
1. (a) Suppose D p E and E NP. Then, there is a polynomialtime computable function f such that for
all inputs x (for D), f (x) is an input for E and x is a yesinstance for D i f (x) is a yesins
Rules for the Conduct of Examinations
1.
No person will be allowed in an examination room during an examination except the candidates
concerned and those supervising the examination.
2.
Candidates must appear at the examination room at least twenty minute
CSC 373
Homework Assignment # 1
Worth: 7.5%
Fall 2012
Due: Before 10pm on Tuesday 2 October.
Remember to write the full name, student number, and CDF/UTOR email address of each group
member prominently on your submission.
Please read and understand the po
CSC 373 H1
Midterm Test Solutions
29 October 2012
Note to Students: This le contains sample solutions to the term test together with the marking
scheme and comments for each question. Please read the solutions and the marking schemes and comments
carefull
=
CSC 373 Lecture Summary for Week 8 Fall 2014
=
READINGS: Sections 34.2, 34.3, 34.4.
SELFTEST: Exercises 34.33, 34.37.
Recall definitions for P and NP:
 The class P: All decision problems that have polytime algorithms.
 The class NP: All decision
=
CSC 373 Lecture Summary for Week 1 Fall 2014
=
READINGS: Sections 16.1, 16.2 (ignore dynamic programming), 23 (all).

Introduction

Course Information Sheet.
Example: Suppose 10^9 ops/sec.
Task: collect raw petrol from 100 oil platforms.
a. Use a tan
=
CSC 373 Tutorial Solutions for Week 3 Fall 2014
=
Work through the steps in the paradigm onebyone, making sure everyone is
caught up before moving on to the next step. For example, it's pointless to
try to define an array until you have a clear idea w
=
CSC 373 Tutorial Solutions for Week 5 Fall 2014
=
1. (a) Augmenting path Residual capacity
s 0/10> a 0/5> t 5
(Remember: "augmenting f along path P" means to add the residual
capacity to each forward edge, and to subtract it from each backward
=
CSC 373 Lecture Summary for Week 9 Fall 2014
=
READINGS: Sections 34.4, 34.5.
SELFTEST: No suitable exercise in the textbook.
 Cook's Theorem: SAT is NPcomplete.
. SAT in NP: (last time)
. SAT is NPhard (main idea):
Let D be any problem in NP. B
=
CSC 373 Tutorial Solutions for Week 8 Fall 2014
=
1. The following algorithm decides TRIANGLE.
On input G:
For each triplet of vertices (u,v,w) in G:
Return True if G contains each edge (u,v), (v,w), (w,u).
Return False if no triplet checked out.
=
CSC 373 Lecture Summary for Week 6 Fall 2014
=
READINGS: Sections 29 (intro), 29.1, 29.2.
SELFTEST: Exercises 29.11, 29.22.
ProfinaBox on Oct 17.
Applications of network flows:
 Maximum bipartite matching:
Input: An undirected bipartite graph G
=
CSC 373 Tutorial Solutions for Week 1 Fall 2014
=
1. Algorithm:
d = [1, 5, 10, 25] # coin values (aka "denominations")
k = 3 # start with largest denomination
C = [] # list of coins used to make change
while A > 0:
if A < d[k]:
# Try the next sma
=
CSC 373 Lecture Summary for Week 12 Fall 2014
=
READINGS: None for this week!
Knapsack:
 Input: Weight limit W, items (v_1,w_1),.,(v_n,w_n) where v_i is
"value" and w_i is "weight" of item i  all nonnegative integers.
Output: Selection of items S
=
CSC 373 Lecture Summary for Week 10 Fall 2014
=
READINGS: Section 34.4, 34.5.
SELFTEST: Trace the reductions covered during last week's lectures on two
examples for each reduction: one where the answer is True and the other
where the answer is False.
=
CSC 373 Tutorial Exercises for Week 11 Fall 2014
=
1. In class, we defined the notion of approximation ratio for MINimization
problems, so that the ratio is a real number >= 1.
Give a precise definition of approximation ratio for MAXimization
proble
=
CSC 373 Tutorial Exercises for Week 3 Fall 2014
=
Consider again the problem of making change when the denominations are
arbitrary.
* Input: Positive integer "amount" A, positive integer "denominations"
d[1] < d[2] < . < d[m].
* Output: List of "coin
=
CSC 373 Tutorial Exercises for Week 9 Fall 2014
=
Recall that a path in a graph is _simple_ iff it contains no repeated vertex
or edge. The definition of simple cycle is similar (except, of course, that
the first and last vertex are the same). Consider
=
CSC 373 Tutorial Exercises for Week 10 Fall 2014
=
Show that SAT is polytime selfreducible.
Pay attention to the details! In particular, be very specific about what
constitutes an input to your decision algorithm and your search algorithm.
=
CSC 373 Tutorial Exercises for Week 8 Fall 2014
=
1. Show that the following TRIANGLE decision problem belongs to P.
Input: An undirected graph G = (V,E).
Question: Does G contain a "triangle", i.e., a subset of three
vertices with all edges between
Solt, George. California Studies in Food and Culture : The Untold History of Ramen : How Political Crisis in Japan Spawned a Global Food Craze (1). Berkeley, US: University of California Press, 2014. ProQuest ebrary. Web. 24 March 2017.
Copyright 2014. Un
CSC373, Winter 2007
Assignment 3
Due: Monday, April 3, 2017, 11am on MarkUs
You will receive 20% of the points for any (sub)problem for which you write I do
not know how to answer this question. You will receive 10% if you leave a question
blank. If inste
CSC373, Winter 2007
Assignment 1
Due: Friday, Feb 3, 2017, 11am on MarkUs
You will receive 20% of the points for any (sub)problem for which you write I do
not know how to answer this question. You will receive 10% if you leave a question
blank. If instead
CSC373, Winter 2007
Assignment 2
Due: Friday, March 10, 2017, 11am on MarkUs
You will receive 20% of the points for any (sub)problem for which you write I do
not know how to answer this question. You will receive 10% if you leave a question
blank. If inst
CSC373 Oct 21
Network Flows: definition, FordFulkerson algorithm and theorem
(max flow = min cut)
Applications
Linear Programming
Problem: Maximum Bipartite Matching
IN: undirected bipartite graph G
OUTPUT: a matching in G a subset
M subsetof E with no t