{% hint style="info" %} A greedy algorithm is a simple heuristic approach that seels to fins the optimal solution to a problem by making locally optimal choices at each step. In other words, it makes the best possible decision at each step wihtou considering the overall problem, hoping that whis will lead to the best possible solution overall. {% endhint %}
The key feature of a greedy algorithm is that it makes a choice that seems best at the moment, without worrying about future consequences or whether that choice will lead to an optimal solution. This can often be a useful approach, as it is generally fast ans easy to implement, but it can also be risky, as it may not always produce the best possible solution.
{% embed url="https://gist.github.com/Aisuko/e617de63ffb478d4da9a41456917f076" %} Activity selection for greedy algorithm {% endembed %}