CSC 373H1 Summer 2012
Tutorial Notes # 6
July 17, 2012 (Version 1.1)
Question #1: Vertex cover in a bipartite graph
A bipartite graph is a graph G = (U W, E ) where the vertex set is composed of two parts U and W and
every edge has one end point in U and
CSC 373
Tutorial # 3
Instructor: Milad Eftekhar
Problem 1. Fractional Knapsack (greedy algorithm). There are n items I1 , , In . Item Ii has weight wi and
worth vi . All these items can be broken into smaller pieces. We have a knapsack with capacity S and
CSC 373
Tutorial # 5
Instructor: Milad Eftekhar
Problem 1: Consider the following Longest Increasing Sublist problem.
Input: A list of integers L = [a1 , a2 , . . . , an ].
Output: A sublist L = [ai1 , ai2 , . . . , aik ] such that 1
maximum.
i1 < i2 < <
CSC 373
Tutorial # 1
Instructor: Milad Eftekhar
Interval Scheduling Problem on m machines (m-ISP): Schedule a set of intervals cfw_I1 , I2 , , In on m
machines such that no two intervals scheduled on the same machine intersect. Note that each interval Ii
CSC 373
Instructor: Milad Eftekhar
Tutorial # 10
1. Show that the INDEPENDENT-SET decision problem is NP-hard.
Input: An undirected graph G = (V, E ), positive integer k .
Question: Does G contain an independent set of size at least k ? (Recall that an in
CSC 373
Tutorial # 8
Instructor: Milad Eftekhar
Describe each problem with a linear or integer program.
1. Simple Scheduling with Prerequisites (SSP):
Given a set of problems, some of which need to be nished in order to begin others, give start times to t
CSC 373
Instructor: Milad Eftekhar
Tutorial # 9
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 them pr
Lecture 6 - Dijkstra's Algorithm and
Dynamic Programming
We began the lecture with a few concluding remarks on greedy algorithms. Greedy algorithms are
primarily useful due to their simplicity, as they are:
1.
2.
3.
Intuitively easy to apply to many probl
Lecture 5 - Minimum Spanning Tree
Algorithms
The minimum spanning tree problem is an elementary problem on graphs which often forms a
building block of more complicated algorithms. Like the shortest path problem solved by Dijkstra's
algorithm, the MST sol
Assignment 1
CSC373 Fall 2016
Due Date: September 30th, 4:59pm, via MarkUs
Note: We will not grade all of these problems. Your grade will be based only on
the problems we do grade. Doing well (or poorly) on the
=
CSC 373 Sample Solutions for Tutorial 1 Fall 2015
=
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:
while A < d[k]:
# Try the nex
CSC 373
Tutorial # 2
Instructor: Milad Eftekhar
Problem 1. If graph G is connected and contains more than n 1 edges (where n = |V |, as usual), and if there
is a unique edge e with minimum cost, then is e guaranteed to be in every MST of G? If so, give a
In this lecture we continued our brief foray into coding theory and discussed the Huffman coding
algorithm. The Huffman coding algorithm is actually the "workhorse" of the coding industry - choose
any standard compression scheme that you can think of (e.g
Tutorial Notes # 3
CSC 373H1 Summer 2012
June 5, 2012 (Version 1.1)
Question #1: Planning a company party (Problem 15-6 from CLRS)
You are asked to plan the company party for a big company and the rst step is to choose who will be
invited. There are two f
CSC 373H1 Summer 2012
Tutorial Notes # 2
May 29, 2012 (Version 1.2)
Question #1: Scheduling unit jobs with penalties and deadlines
You are given n job the ith of which has deadline di and penalty pi . Each job takes precisely one hour to
nish and can not
CSC 373H1 Summer 2012
Tutorial Notes # 1
May 22, 2012 (Version 1)
Question #1: Interval Scheduling
Given n jobs, each an interval with a starting time si and nishing time ti choose the maximum number
of them that dont intersect. I have already gone over t
CSC 373H1 Summer 2012
Assignment # 2: Solutions
Version 1.1(July 8, 2012)
Due: Tuesday July 3rd at 6:00PM in class, or Thursday July 5th at 6:00PM electronically
Worth: 4%.
For each question you have to clearly write your algorithm in English and prove th
CSC 373H1 Summer 2012
Assignment # 1
Version 1.5(June 2, 2012)
Due: Tuesday June 5th at 6:00PM in class, or Thursday June 7th at 6:00PM electronically
Worth: 4%.
For each question you have to clearly write your algorithm in English and prove that it nds t
Term Test # 2
Summer 2012
CSC 373 H1
Duration: 75 minutes
Aids Allowed: NONE (in particular, no calculator)
Student Number:
Last (Family) Name(s):
First (Given) Name(s):
Do not turn this page until you have received the signal to start.
In the meantime, p
Term Test # 1
Summer 2012
CSC 373 H1
Duration: 80 minutes
Aids Allowed: NONE (in particular, no calculator)
Student Number:
Last (Family) Name(s):
First (Given) Name(s):
Do not turn this page until you have received the signal to start.
In the meantime, p
Lecture 1
Class overview:
- The interval scheduling problem (Hot Date!)
- Different greedy heuristics to the ISP.
- The earliest starting time (EST) heuristic (and how badly it performs)
- Definition of the approximation ratio
- Earliest finish time heuri
First, let's recall the the definition of the approximation ratio of an algorithm. Suppose that we are
trying to solve some combinatorial optimization problem
P
where we are given some input
I
, and want to give an algorithm
ALG
which produces an output
A
Once again, here is the problem setup. We have two people (named Alice and Bob) who are
communicating via a channel
C
which can only send sequences of bits. Alice and Bob, however, would prefer to send messages to each
other using the regular English alph
=
CSC 373 Sample Solutions for Tutorial 1 Fall 2015
=
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:
while A < d[k]:
# Try the nex