For finding the optimum solution of the problem greedy algorithm is used for it. It can solve problem from any domain we want.
Greedy algorithm try to find localized solution which may comes inside global solutions.
T
his problem is to count to a desired value by chosing least possible coins and greedy approach forces the algorithm to pick the largest possible coin. If we are provided coins of 1, 2, 5 and 10 and we are asked to count 18 then the greedy procedure will be
1 Select one 10 coin, remaining count is 8
2 Then select one 5 coin, remaining count is 3
3 Then select one 2 coin, remaining count is 1
3 And finally selection of one 1 coins solves the problem
Examples
Most networking algorithms uses greedy approach. Here is the list of few of them −
0 Comment(s)