Usage examples of greedy algorithms?

2019-03-11 05:45发布

What is the use of greedy algorithms? An real example?

8条回答
冷血范
2楼-- · 2019-03-11 06:22

A real life example of Greedy Algorithm will be Interval Scheduling.

For example if you want to maximize the number of customers that can use a meeting room, you can use Interval Scheduling Algorithm.

查看更多
爷、活的狠高调
3楼-- · 2019-03-11 06:24

Some problems are such that a greedy solution will actually be optimal, and sometimes they're engineered that way. A fun example is that many countries' coin values are such that a greedy approach to returning change (i.e. always returning the largest-possible coin until you're done) works.

查看更多
登录 后发表回答