P. 1
ALGORITHMS DESIGN TECHNIQUES AND ANALYSIS

# ALGORITHMS DESIGN TECHNIQUES AND ANALYSIS

|Views: 9,685|Likes:

### Availability:

See more
See less

05/05/2013

pdf

text

original

Dynamic programming was ﬁrst popularized in the book by Bellman (1957).
Other books in this area include Bellman and Dreyfus (1962), Dreyfus
(1977) and Nemhauser (1966). Two general survey papers by Brown (1979)
and Held and Karp (1967) are highly recommended. The all-pairs short-
est paths algorithm is due to Floyd (1962). Matrix chain multiplication is
described in Godbole (1973). An O(nlogn) algorithm to solve this prob-
lem can be found in Hu and Shing (1980, 1982, 1984). The one and two
dimensional knapsack problems have been studied extensively; see for ex-
ample Gilmore (1977), Gilmore and Gomory (1966) and Hu (1969). Held
and Karp (1962) gave an O(n2

2n

) dynamic programming algorithm for the
traveling salesman problem. This algorithm also appears in Horowitz and
Sahni (1978).

PART 3

First-Cut Techniques

227

228

229

When a solution to a problem is sought, perhaps the ﬁrst strategy that
comes to one’s mind is the greedy method. If the problem involves graphs,
then one might consider traversing the graph, visiting its vertices and per-
forming some actions depending on a decision made at that point. The
technique used to solve that problem is usually speciﬁc to the problem itself.
A common characteristic of both greedy algorithms and graph traversal is
that they are fast, as they involve making local decisions.
A graph traversal algorithm might be viewed as a greedy algorithm and
vice-versa. In graph traversal techniques, the choice of the next vertex to
be examined is restricted to the set of neighbors of the current node. This
is in contrast to examining a bigger neighborhood, clearly a simple greedy
strategy. On the other hand, a greedy algorithm can also be viewed as a
graph traversal of a particular graph. For any greedy algorithm, there is
an implicit directed acyclic graph (dag) each of whose nodes stands for a
state in that greedy computation. An intermediate state represents some
decisions that were already taken in a greedy fashion, while others remain
to be determined. In that dag, an edge from vertex u to vertex v exists only
if in the greedy method the algorithm’s state represented by v is arrived at
from that represented by vertex u as a consequence of one decision by the
greedy algorithm.

Although these techniques tend to be applied as initial solutions, they
rarely remain as the providers of optimal solutions. Their contribution
consequently is one of providing an initial solution that sets the stage for
careful examination of the speciﬁc properties of the problem.
In Chapter 8, we study in detail some algorithms that give optimal solu-
tions to well-known problems in computer science and engineering. The two
famous problems of the single-source shortest path, and ﬁnding a minimum
cost spanning tree in an undirected graph are representative of those prob-
lems for which the greedy strategy results in an optimal solution. Other
problems, like Huﬀman code, will also be covered in this chapter.
Chapter 9 is devoted to graph traversals (depth-ﬁrst search and breadth-
ﬁrst search) that are useful in solving many problems, especially graph and
geometric problems.

230

Chapter 8

The Greedy Approach

scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->