The greedy method:
A greedy algorithm builds a solution to a problem in steps. At each
step, it adds a part of the solution. Which part of the solution to add
next is determined by a greed rule. The rule is "greedy" in the sense
that among all
of the parts of solution that might be choosen, the best available is
selected.(
Greedy.ppt)(
ShortestPath.zip)
Homework3: Due date:
midnight
of the day before next TA class
A. Consider the problem of making change for n
cents
using the fewest number of coins. Assume that each coin's value is an
integer.
Describe a greedy algorithm to make change consisting of quarters
(25c),
dimes (10c), nickels (5c), and pennies (1c).
B. Show a counter example that Dijkstra algorithm does not work.
C. Show the correctness of
Kruskal,
Prim, Dijkstra, Bellman-Ford, or Floyd-Warshell algorithms.
(You
should prove the correctness of at least one algorithm.
If you prove the
correctness
of more than one algorithm, you will get a bonus.)
D. (Bonus) Show that
Bellman-Ford
algorithm can detect a negative-weight cycle.
E. (Bonus) Write a program to
implement
Kruskal, Prim, Dijkstra, Bellman-Ford, or
Floyd-Warshell algorithms in
any language.
F. (Bonus) Given a plan of nodes
(or
points) N0, N1,..., Nm, where each node has a constrainted out-degree
(or
capacity) C0, C1,...,Cm, write a greedy algorithm to construct a
spanning
tree rooted at N0 shuch that the tree has the smallest summation of
"accumulated
distances" from N0 to every other nodes.
Paper: Jehn-Ruey Jiang,
Chao-Wei Hung, and Jih-Wei Wu, "Bandwidth- and Latency-Aware
Peer-to-Peer Instant Friendcast for Online Social Networks," 4th International
Workshop on Peer-to-Peer Networked Virtual Environment (P2P-NVE 2010), Shanghai,
China, 2010.