At each step, greedily pick the cheapest edge that reaches a new vertex. Careful: sometimes a greedy algorithm doesn't give you an optimal solution: When filling a duffel bag with cakes of different weights and values, choosing the cake with the highest value per pound doesn't always ...
Greedy algorithms are by far one of the easiest and most well-understood algorithmic techniques. There is a wealth of variations, but at its core the greedy algorithm optimizes something using the natural rule, “pick what looks best” at any step. So a greedy routing algorithm would say to...
money,usingthefewestpossiblebillsandcoins •Agreedyalgorithmwoulddothiswouldbe: Ateachstep,takethelargestpossiblebillorcoin thatdoesnotovershoot –Example:Tomake$6.39,youcanchoose: •a$5bill •a$1bill,tomake$6 •a25¢coin,tomake$6.25 ...