Divide-and-conquer
Divide-and-Conquer (Input: Problem P) To Solve P: 1. Divide P into smaller problems P1 , P2 , P3 .Pk . 2. Conquer by solving the (smaller) subproblems recursively. 3. Combine solutions to P1 , P2 , .Pk into solution for P.
1
MergeSort
Algorithms Homework 9
Graphs II
1. (CLRS 22-4) Reachability: Let G = (V, E) be a directed graph in which each vertex u
is labeled with a unique integer L(u) from the set cfw_1, 2, ., |V |. For each vertex u, let
R(u) be the set of vertices that are reacha
Algorithms Homework 8
Fundamental techniques: Graph basics
1. (CLRS 22.2-3) Analyse BFS running time if the graph is represented by an adjacencymatrix.
2. (4.2.27 Sedgewick Wayne) Explain why the following algorithm does not necessarily
produce a topologi
Algorithms Homework 6
Fundamental techniques: Dynamic programming and greedy algorithms
1. Argue that the following greedy strategies do not work for the 0-1 knapsack problem
by giving a counter-example in each case:
a. Select the items in order of their
Algorithms Homework 7
In this assignment you will write code, in a language of your choice, to implement part
(d) of the skis and skiers problem in the previous homework. Here is the problem:
There are m skiers and n pairs of skis, with n m, and assume we
Algorithms Homework 5
Techniques: Divide and conquer and such
1. In this problem we consider a monotonically decreasing function f : N Z (that
is, a function dened on the natural numbers taking integer values, such that f (i) >
f (i + 1). Assuming we can