Greedy Algorithms

  • Greedy algorithms picks the “best” next partial solution (aka locally optimal solution) from the current partial solution at every step and may not always produce an optimal solution.

  • A greedy algorithm usually visits each node once, and often this translates to linear complexity, but not always. It may not always produce an optimal solution.

  • Examples: MST algorithms like Prim’s and Kruskal’s, Dijkstra’s algorithm, making change using U.S. coins, Huffman coding.

results matching ""

    No results matching ""