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
Fall 2012
Homework Assignment # 1 Sample Solutions
1. (a) Order the requests by non-increasing 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 sub-problems.
Consider an input E = f (e1 , e2 , . . . , en ). Note that if any ei is a variable, then it ha
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 - 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
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
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 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 - 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
Homework Assignment # 4 Sample Solutions
Fall 2012
1. (a) Suppose D p E and E NP. Then, there is a polynomial-time computable function f such that for
all inputs x (for D), f (x) is an input for E and x is a yes-instance for D i f (x) is a yes-ins
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 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
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 Tutorial Exercises for Week 2 Fall 2014
=
1. (a) Prove or disprove: If e is a minimum-weight edge in connected graph
G (where not all edge weights are necessarily distinct), then every
minimum spanning tree of G contains e.
(b) Does your ans
=
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
=
CSC 373 Tutorial Exercises for Week 10 Fall 2014
=
Show that SAT is polytime self-reducible.
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 4 Fall 2014
=
Use dynamic programming to solve the all-pairs shortest paths problem, based
on the idea of restricting path length.
More precisely, to get you started, consider a shortest (minimum-weight) path
from u t
=
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 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 12 Fall 2014
=
1. Give an algorithm that attempts to find a large independent set in a
graph where all vertices have degree at most d. Figure out a good bound
on the approximation ratio of your algorithm, and argue
=
CSC 373 Tutorial Solutions for Week 2 Fall 2014
=
1. (a) FALSE. Take G = triangle with all edge weights 1. For any edge e, some
MST of G does not contain e.
(b) TRUE.
Hint 1: Try a proof by contradiction.
Hint 2: Review the "exchange lemma" in the
CSC 373 H1, L5101
Fall 2014
Midterm Test
Duration: 50 minutes
Aids Allowed: One single-sided hand written 8.5"11" 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.
I
CSC 373 H1, L0101
Fall 2014
Midterm Test
Duration: 50 minutes
Aids Allowed: One single-sided hand written 8.5"11" 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.
I
=
CSC 373 Tutorial Solutions for Week 12 Fall 2014
=
1. Algorithm:
Idea: greedy strategy - pick vertices with smallest degree first
Pseudocode:
I <- cfw_
while V != cfw_:
select v in V with minimum degree
I <- I u cfw_v
let N(v) be the set of neig
=
CSC 373 Tutorial Solutions for Week 11 Fall 2014
=
1. Let OPT be the maximum value of any solution and let A be the value of
the solution returned by the algorithm. Then A <= OPT (by definition of
OPT) and the approximation ratio is the factor by whi
=
CSC 373 Tutorial Solutions for Week 10 Fall 2014
=
Show that SAT is polytime self-reducible.
Q: What does this means exactly? What do we need to set up?
A: Need a precise description of SAT decision problem and SAT search
problem.
SAT decision - fro
=
CSC 373 Tutorial Solutions for Week 9 Fall 2014
=
Showing that both problems belong to NP - "short" version of the argument; do
take the time to explain details as necessary, for students who are still
uncomfortable with the idea of verifiers.
- HP in
=
CSC 373 Tutorial Solutions for Week 6 Fall 2014
=
1. Given input, create network with vertices p_1,.,p_n, c_1,.,c_m, s, t;
and edges (s,p_i) of capacity L_i for each p_i, (c_j,t) of capacity S_j
for each c_j, edges (p_i,c_j) of capacity 1 for each p_
=
CSC 373 Tutorial Solutions for Week 4 Fall 2014
=
[Section 25.1 in the textbook has an alternative presentation.]
0. Recursive structure:
Consider shortest u-v path P. Either P = (u,v) or P = shortest u-t path +
(t,v) for some vertex t - if u-t part
=
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 H1
Nasir Mohammad
1000845570
ASSIGNMENT #1
CSC 373 H1
Nasir Mohammad
1000845570
1. MST with Fixed Leaves
(a) This problem does not always have a solution.
Definition: We can define a leaf in a graph as a vertex that is connected by only a single
e
CSC 373 H1
Nasir Mohammad
1000845570
ASSIGNMENT #2
CSC 373 H1
Nasir Mohammad
1000845570
1.
(a) Pseudo-flow gives the appearance of the typical objective of finding maximum flow,
but is used in our purpose for minimizing total path length by applying const
CSC373 Algorithm Design, Analysis, and Complexity Spring 2016
Solutions for Tutorial Exercise 4: Network Flow
1. Bookkeeping for the Residual Graph. Suppose G = (V, E, c) is the directed graph for an s-t flow
problem. That is, there are two identified ver
CSC373 Algorithm Design, Analysis, and Complexity Spring 2016
Solutions for Tutorial Exercise 5: P, NP, and NP-Complete
1. Set Packing. The set packing decision problem is defined as follows:
SetPack: Given a universe set U , a set of subsets F = cfw_Sj |
CSC373 Algorithm Design, Analysis, and Complexity Spring 2016
Solutions for Tutorial Exercise 7: Approximation Algorithms
1. Q6 on the CSC373 Final Exam, April 2012. Given N items with weights W = [w1 , w2 , . . . , wN ], we
wish to place each of these it