Академический Документы
Профессиональный Документы
Культура Документы
(CS210/ESO207/ESO211)
Lecture 33
Greedy strategy: a new algorithm paradigm
Part II
1
[s(), f()] =
Notation
Overlap(): the subset consisting of and every job of which
overlaps .
3
Opt(): the size of an optimal solution for .
Selecting such a job will free the server earliest and hence more no. of jobs
will get scheduled.
Selecting such a job will free the server earliest and hence more no. of jobs
will get scheduled.
Selecting such a job will free the server earliest and hence more no. of jobs
will get scheduled.
Selecting such a job will free the server earliest and hence more no. of jobs
will get scheduled.
Selecting such a job will free the server earliest and hence more no. of jobs
will get scheduled.
}
3. Return ;
Salient features of
= Opt() + 1.
Theorem: Opt()
the optimal solution of original instance of the problem
the optimal solution of (smaller) instance obtained by
the greedy step
Overlap()
11
Overlap()
12
Theorem: Given any set of jobs, the algorithm based on
earliest finish time approach computes the largest subset of
non-overlapping job.
13
Algorithm
Algorithm (Input : set of
jobs.)
1. Define ;
2. While <> do
{
time;
U {};
\Overlap();
}
3. Return ;
14
Problem 2
First we shall give motivation.
15
Motivation:
A road or telecommunication
network
Motivation
Formal description of the problem
Input: an undirected graph G=(V,E).
Aim: compute a subgraph (V,E), E E such that
Connectivity among all V is guaranteed in the subgraph.
|E| is minimum.
17
A road or telecommunication
network
18
A road or telecommunication
network
A tree
The
following definitions are equivalent.
A Spanning tree
Definition: For an undirected graph (V,E), spanning tree is a
subgraph (V,E), E E which is a tree.
A road or telecommunication
network
Assign each edge a weight/cost.
33
54
63
35
70
64
78
31
50
41
53
80
49
170
54 49
44
29
81
52
60
57
42
50
30
102
Adding more reality to the
problem
22
A road or telecommunication
network
170
33
54
63
35
70
64
78
41
53
80
49
31
50
54 49
44
57
81
52
60
42
50
30
102
Any arbitrary 29
spanning tree (like the
one shown above) will not
serve our goal.
We need to select the spanning tree with least weight/cost.
23
Problem 2
Minimum spanning tree
24
Problem Description
Input: an undirected graph G=(V,E) with w: E ,
Aim: compute a spanning tree (V,E), E E such that is
minimum.
25
54
63
35
70
64
78
41
53
80
49
31
50
54 49
44
29
81
52
60
57
42
50
30
102
27
28
29