5
1/25/08 - Greedy Scheduling Algorithms
Lecture: Greedy scheduling algorithms Reading: Chapter 4.1, 4.2 Interval Scheduling (jobs) Input: A set of pairs (si, ti)Ti=1 0 si ti T, si, ti N Output: A feasible schedule: a subset of the pairs, s.t. t
Solution Set for CS 482, Prelim 2 April 8, 2008 Questions in red, solutions in black. PROBLEM 1 (20 points)
PART A (15 points) Find a maximum flow and minimum s-t cut in the flow network G shown here. The source and sink are s and t, respectively. Th
Introduction to Algorithms CS 482, Spring 2008
Solution Set 7
(1) First, we prove that Party Invitation is in NP. There is a polynomial-time verier that takes an instance I of Party Invitation consisting of numbers n, k, lists Pi (1 i k), and va
6
1/28/08 - Five Representative Problems
Lecture: Five representative problems Reading: Chapter 1.2 Earliest Start Time with Pre-emption (1) Preprocess the input to remove jobs whose interval contains another jobs interval (2) Sort the remaining job
Introduction to Algorithms CS 482, Spring 2008
Solution Set 3
(1) (a) Heres a counterexample in which n = 3. Week 1 Week 2 Week 3 1 1 1 0 3 10
i
hi
The optimal solution picks the low-stress job in week 1 and the high-stress job in week 3. The gr
CS 482 FINAL EXAM SOLUTION SET
(1) (10 points) Each of the following statements is false. Give a counterexample to each of them. (1a) (5 points) If G is any graph with non-negative edge costs, and e is any edge such that every minimum-cost spanning
Introduction to Algorithms CS 482, Spring 2008
Solution Set 2
(1) The algorithm restores the websites in decreasing order of ci /ti , where ci is the rate of lost dollars per hour for site i, and ti is the number of hours to nish the job. Analysis
Introduction to Algorithms CS 482, Spring 2008
Solution Set 3
(1) We describe an algorithm Test(S) whose input is a set S of bank cards and whose output is: a bank card x S such that more than half the elements of S are equivalent to x, if any su
Introduction to Analysis of Algorithms
CS4820 Spring 2013
Sample Homework Solutions
Thursday, January 24, 2013
Based on the original version by Constadino Moraites and Bobby Kleinberg, CS 4820 S12.
1
The Good, the Bad, and the Ugly
This handout discusses
Introduction to Algorithms CS 482, Spring 2008
Solution Set 1
(1) This problem can be solved using a greedy algorithm which always attempts to place the next cell phone tower as far east as possible without leaving a house uncovered. The algorithm
CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS
http:/www.cs.cornell.edu/courses/cs1110/2017sp/labs/lab01.pdf
First Name:
Last Name:
NetID:
Learning goals: (1) get hands-on experience using Python in interactive mode via the command
shell; (2) get hands-on ex
Introduction to Algorithms (CS 482)
Instructor: Bobby Kleinberg
Cornell University
Lecture Notes, 25 April 2008
The Miller-Rabin Randomized Primality Test
1
Introduction
Primality testing is an important algorithmic problem. In addition to being a fundame
CS 1110, LAB 3: STRINGS; TESTING
http:/www.cs.cornell.edu/courses/cs1110/2017sp/labs/lab03.pdf
First Name:
Last Name:
NetID:
Getting Credit: Deadline: the first 10 minutes of (your) lab two weeks from now (Tue Feb 28
or Wed Mar 1), due to February break.
CS 1110, LAB 02: FUNCTIONS AND (IN) MODULES SOME HI-LIGHTS
http:/www.cs.cornell.edu/courses/cs1110/2017sp/labs/lab02.pdf
Last Name:
First Name:
NetID:
Lab updated from the printed version on Feb 6 4:38pm: on pg 7, see change in orange.
Learning goals: Pra
CS 1110 Spring 2017, Assignment 1: Currency Conversion
http:/www.cs.cornell.edu/courses/cs1110/2017sp/assignments/hw1.pdf
February 14, 2017
Figure 1: BTC stands for the cryptocurrency Bitcoin, but we sorta wish it stood for BaTCoin.
Thinking about that tr
Problem 4.9 solution
a. If we consider a clique where an edge u has weight 2 and the rest of them having the
weight 3, a MST will certainly contain u, while a minimum bottleneck wont. This shows
that not any minimum bottleneck spanning tree is a MST, also
Introduction to Algorithms (CS 482)
Instructor: Bobby Kleinberg
Cornell University
Lecture Notes, 30 April 2008
Online Prediction Algorithms
1
Binary prediction with one perfect expert
As a warm-up for the algorithms to be presented below, lets consider t
Announcements
Anatomy of a Specification
One line description,
Announcements will be made in lecture about:
Lab 3
Assignment 1
Extra help
More detail about the
Greeting has format 'Hello <n>!' function. It may be
Followed by conversation starter.many
Introduction to Algorithms CS 482, Spring 2008
Solution Set 6
(1) (a) To compute whether the blood on hand meets the projected demand, one can construct a ow network with 10 vertices. A super-source s. For each blood type x, a pair of vertices ux
Problem 27
Lets first try to see what happens if for two different spanning trees of G, there is exactly one
edge that is into one of the spanning trees and not in the second. This case, according the
provided definition, it means that T and T will be nei
Problem 1.2
Decide whether you think the following statement is true or false. If it is true, give a short explanation. If it is false,
give a counter example.
True or false? Consider an instance of the Stable Matching Problem in which there exists a man
Exercises 1
Decide whether you think the following statement is true or false. If it is true, give a short explanation. If it is false,
give a counterexample. True or false? In every instance of the Stable Matching Problem, there is a stable matching
cont
29
3/28/08 - NP-complete coloring proble.
NP-complete problems 3SAT, k-SAT (k > 3) IND. SET CLIQUE VERTEX COVER HAMILTONIAN PATH/CYCLE TRAV. SALES. PROB. Reduce FROM . TO (e.g. set cover) if you could use set cover to solve trav salesman in poly tim
38
4/21/08 - Randomized algorithms
Randomized Algorithms Review Ch. 13.12, read 13.1 - 6. A probability space consists of a sample set (nite in CS 482) and a probability 0 Pr(x) 1 for every x , s.t. x(x) = 1. Examples. Flipping coin n times = {
30
3/31/08 - NP-complete numerical probl.
NP-Complete Problems 3SAT Vtx Cover Indep. Set (even in deg 3) Clique Hamiltonian Path Set cover/packing Traveling salesman 3D matching Subset Sum. 3-D Matching Given sets X, Y, Z, with n elts each. Given 3
Introduction to Algorithms CS 482, Spring 2008
Solution Set 9
(1) Let T be the number of trucks used by the algorithm, and suppose the trucks are labeled 1, 2, . . . , T in the order that the algorithm loads them up. Observe that for i = 1, 2, . .