|
This section contains 584 words (approx. 2 pages at 300 words per page) |
|
A greedy algorithm (like a normal algorithm) is a rule or process that provides a solution to a problem. But a greedy algorithm is not an algorithm proper--it is a heuristic, it works in stages, making a series of short-term decisions that will be the best possible at the present time, without regard for what might happen in the future. In essence a greedy algorithm takes a series of immediate, local optimums in the hope that, when the process terminates, it has achieved a global optimum as well.
Making change is one example of a greedy algorithm since one generally wants to use the smallest number of coins possible. If one is asked for 74 cents and the coins on hand have values of 25, 10, 5 and 1 cents, the person receiving the change would get two 25 cent pieces, then two 10 cent pieces, and finally four 1 cent pieces. Any other...
|
This section contains 584 words (approx. 2 pages at 300 words per page) |
|

