Skip to content

Files

This branch is 593 commits behind ZoranPandovski/al-go-rithms:master.

greedy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 20, 2018
Oct 14, 2018
Sep 28, 2021
Oct 31, 2021
Oct 24, 2020
Oct 5, 2019
Oct 11, 2021
Oct 27, 2018
Mar 15, 2018
Oct 16, 2021
Dec 2, 2017
Oct 24, 2020
Oct 22, 2019
Oct 25, 2018
Oct 31, 2020
Oct 22, 2021
Oct 17, 2020
Oct 16, 2018
Oct 10, 2021
Oct 31, 2020
Oct 2, 2018
Oct 3, 2018
Nov 23, 2020
Oct 4, 2018

Greedy Algorithm

A greedy algorithm is a mathematical process that looks for simple, easy-to-implement solutions to complex, multi-step problems by deciding which next step will provide the most obvious benefit.

Such algorithms are called greedy because while the optimal solution to each smaller instance will provide an immediate output, the algorithm doesn’t consider the larger problem as a whole. Once a decision has been made, it is never reconsidered.

Greedy algorithms work by recursively constructing a set of objects from the smallest possible constituent parts. Recursion is an approach to problem solving in which the solution to a particular problem depends on solutions to smaller instances of the same problem. The advantage to using a greedy algorithm is that solutions to smaller instances of the problem can be straightforward and easy to understand. The disadvantage is that it is entirely possible that the most optimal short-term solutions may lead to the worst possible long-term outcome.

Greedy algorithms are often used in ad hoc mobile networking to efficiently route packets with the fewest number of hops and the shortest delay possible. They are also used in machine learning, business intelligence (BI), artificial intelligence (AI) and programming.

Examples

Further reading: Wikipedia