Greedy algorithms are easy to implement in most cases, they are one of the most used programming schemas when it comes to solving optimization problems, they are also a very good option because of their low resource consumption.
They have a little downside and it is that, they don’t always guarantee the optimal solution, they will get a close approach to the optimal but not always find it. Anyway in many cases, a close-to-optimal solution is more than enough.
When talking about complexity, they typically take “n” iterations for an “n” sized problem so their complexities vary from O(n), O(n × log(n)) or as much as O(n²)

#software-development #algorithms #coding #programming #software-engineering

Greedy Algorithms 101
1.20 GEEK