Algorithms - CSE 202
Mathematical Preliminaries and Introductory Problems
Writing Style: We suggest the following steps in writing up your solutions, when they are applicable. For a detailed
writing style guidelines, please consult http:/cseweb.ucsd.edu/
Fundamental Tools for Algorithmic Problem Solving
The collection of problems is designed to test the competency of the students in applying
fundamental mathematical tools for algorithmic problem solving. Solving these problems requires a
good understandin
CSE 202: Design and
Analysis of Algorithms
Lecture 10
Instructor: Kamalika Chaudhuri
Announcements
Midterm on Feb 14 in class
Material: Greedy, Divide and Conquer, Dynamic
Programming, Flows (including Capacity Scaling, but
not including Preow-push)
Last
CSE 202 Spring 2010
Solution Set 1 7 April 2010
Chapter 1, Problem 1: The statement is false, which is evident due to the following counterexample with 2 men (m1 and m2 ) and 2 women (w1 and w2 ). The preferences are as follows: m1 prefers w1 to w2 , m2 p
Greedy Method
1
Introduction
Context In general, when you try to solve a problem, you are trying to find a solution from among a large
space of possibilities. You usually do this by making a series of decisions, what move to make at each
step (for example
Algorithms: CSE 202 Homework II
Problem 1: Nesting Boxes (CLRS)
A d-dimensional box with dimensions (x1 , x2 , . . . , xd ) nests within another box with dimensions (y1 , y2 , . . . , yd )
if there exists a permutation on cfw_1, 2, . . . , d such that x(1
CSE 202 Homework 2 Solutions
1 Kleinberg & Tardos, problem 26, page 202. Time-varying Minimum Spanning Tree.
Connected graph G = (V, E ).
Each edge e E has a time-varying edge cost fe = ae t2 + be t + ce such that fe > 0 for all t.
Denote n = |V | and
Greedy Method
1
Topics
Greedy algorithms
Minimum spanning trees
Human codes
2
Exercises
Problem 1: Removing edges (DPV)
Design a linear-time algorithm for the following task.
Input: A connected, undirected graph G.
Output: Is there an edge you can remo
Network Flows
1
Topics
Max-ow
Min-Cut
2
Exercises
3
Problems
Problem 1: Problem 26.1-9, page 650; (CLRS)
Professor Adam has two children who, unfortunately, dislike each other. The problem is so severe
that not only do they refuse to walk to school toge
Algorithms: CSE 202 Homework III
Problem 1: Job scheduling (KT 7.41)
Suppose youre managing a collection of processors and must schedule a sequence of jobs over time.
The jobs have the following characteristics. Each job j has an arrival time aj when it i
Graph Algorithms
1
Topics
Graphs
Depth-rst search
Strongly connected components
Breadth-rst search
2
Exercises
Problem 1: Reverse of a graph (DPV)
The reverse of a directed graph G = (V, E) is another directed graph GR = (V, E R ), on the same
vertex
Algorithms: CSE 202 Homework II
Solve problems 2, 3, 4, 6, and 7.
Problem 1: The tramp steamer problem (DPV)
You are the owner of a steamship that can ply between a group of port cities V . You make money
at each port: a visit to city i earns you a prot o
Introduction to Algorithms
Jon Kleinberg
Eva Tardos
Cornell University
Spring 2003
c Jon Kleinberg and Eva Tardos
2
Contents
1 Introduction
1.1 Introduction: The Stable Matching Problem
1.2 Computational Tractability . . . . . . . . .
1.3 Interlude: Two D
Network Flows
1
Topics
Max-ow
Min-Cut
2
Exercises
3
Problems
Problem 1: Problem 7-8, Page 418, KT
Statistically, the arrival of spring typically results in increased accidents and increased need for
emergency medical treatment, which often requires bloo
Series, Functions, and Recurrence Relations
1
Topics
1. Arithmetic and geometric series
2. Functions
3. Order notation
4. Recurrence relations
2
Exercises
Problem 1: Function growth
Suppose you have algorithms with the six running times listed below. Assu
Series, Functions, and Recurrence Relations
1
Topics
1. Arithmetic and geometric series
2. Functions
3. Order notation
4. Recurrence relations
2
Formulae you should know
You should remember these properties from previous calculus classes:
loga (b c) = lo
Design and Analysis of Algorithms Undergraduate Level
The collection of problems is designed to test the studentscompetency in the design and analysis
of algorithms at the undergraduate level. Solving these problems requires an understanding and
applicati
Fundamental Tools for Algorithmic Problem Solving
The collection of problems is designed to test the competency of the students in applying
fundamental mathematical tools for algorithmic problem solving. Solving these problems requires a
good understandin
Stale Marriage Problem
1
Topics
Stable marriage problem
2
Exercises
Problem 1: Determining all stable matchings
Enumerate all the stable matchings for the four men and four women with the following preference lists.
m1 :w3 > w1 > w4 > w2
m2 :w3 > w2 > w4
Stale Marriage Problem
1
Topics
Stable marriage problem
2
Exercises
Problem 1: Determining all stable matchings
Enumerate all the stable matchings for the four men and four women with the following preference lists.
m1 :w3 > w1 > w4 > w2
m2 :w3 > w2 > w4
Sorting and Order Statistics
1
Topics
1. Sorting
2. Order statistics
2
Exercises
Problem 1: Insertion sort
Insertion sort can be expressed as a recursive procedure as follows. In order to sort A[1.n], we
recursively sort A[1.n 1] and then insert A[n] into
Shortest paths
1
Topics
Minimum spanning trees
Shortest paths (Dijkstras algorithms, shortest-path algorithms in the presence of negative
edge weights)
2
Exercises
Problem 1: Divide-and-conquer spanning tree (CLRS)
Professor Toole proposes a new divide-
Design and Analysis of Algorithms Undergraduate Level
The collection of problems is designed to test the studentscompetency in the design and analysis
of algorithms at the undergraduate level. Solving these problems requires an understanding and
applicati
Shortest paths
1
Topics
Minimum spanning trees
Shortest paths (Dijkstras algorithms, shortest-path algorithms in the presence of negative
edge weights)
2
Exercises
Problem 1: Divide-and-conquer spanning tree (CLRS)
Professor Toole proposes a new divide-
Scheduling Events to Minimize Rooms
Sample greedy solution write-up
Problem 1: Let E = cfw_(si , fi )|1 i n be a set of events to be scheduled in as few rooms as possible without conict
l
Assume that the sequence cfw_si is nondecreasing. If not, sort it