Usage examples of greedy algorithms?

后端 未结 10 1854
孤城傲影
孤城傲影 2021-02-02 15:36

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

10条回答
  •  醉酒成梦
    2021-02-02 16:24

    What is the use of greedy algorithms?

    We use Greedy Algorithm for to get optimal solution.But all problems can't solve using greedy algorithm.

    Optimal substructure property and greedy choice property are key ingredients.if we can demonstrate that the problem has these properties, then we are well on the way to developing a greedy algorithm for it.

    Real examples?

    • Activity sheduling problem
    • Huffman code
    • Coin denomination
    • Single source shortest path problem (Dijkstra)
    • Minimum spanning tree (Prim's algoritnm ,Kruskal's algorithm)
    • Fractional Knapsack problem.

    Almost all problems that can solve using Dynamic approach can be solve by greedy approach.

提交回复
热议问题