Week 5 Discussion Forum

Specifications of Greedy Algorithm

Specifications of Greedy Algorithm

by A.B.M Noman 192-15-2839 -
Number of replies: 2

In general, greedy algorithms have five components:

  • A candidate set, from which a solution is created
  • A selection function, which chooses the best candidate to be added to the solution
  • A feasibility function, that is used to determine if a candidate can be used to contribute to a solution
  • An objective function, which assigns a value to a solution, or a partial solution, and
  • A solution function, which will indicate when we have discovered a complete solution

Greedy algorithms produce good solutions to some mathematical problems, but not on others.

85 words

In reply to A.B.M Noman 192-15-2839

Re: Specifications of Greedy Algorithm

by MD.ANISUR RAHMAN (192-15-2825) -
Greedy algorithm is one of the best algorithm strategy for problem solving. It always makes the choice that seems to be the best at the moment. It makes locally optimal choice that can lead to a globally optimal solution. But it doesn't always find the globally optimal solution as it doesn't consider all the data. Greedy algorithms is quite successful in problems like Huffman encoding, Dijkstra's algorithm, Minimum spanning tree and more on. Greedy algorithm is easy to describe and in many cases it performs better than other algorithms.

89 words

In reply to A.B.M Noman 192-15-2839

Re: Specifications of Greedy Algorithm

by Abdulla Al Moin 192-15-2838 -

Some advantages of Greedy Algorithm :

  • Always taking the best available choice is usually easy. It usually requires sorting the choices.

  • Repeatedly taking the next available best choice is usually linear work. But don't forget the cost of sorting the choices.

  • Much cheaper than exhaustive search. Much cheaper than most other algorithms.

51 words