2 min read

What is a greedy algorithm?

Greedy algorithms are useful for optimization problems. They make the optimal choice at a localized and immediate level, with the aim being that you’ll find the optimal solution you want. It’s important to note that they don’t always find you the best solution for the data science problem you’re trying to solve – so apply them wisely.

In the below video tutorial above, from Fundamental Algorithms in Scala, you’ll learn when and how to apply a simple greedy algorithm, and see examples of both an iterative and recursive algorithm in action. with examples of both an iterative algorithm and a recursive algorithm.

The advantages and disadvantages of greedy algorithms

Greedy algorithms have a number of advantages and disadvantages. While on the one hand, it’s relatively easy to come up with them, it is actually pretty challenging to identify the issues around the ‘correctness’ of your algorithm. That means that ultimately the optimization problem you’re trying to solve by using greedy algorithms isn’t really a technical issue as such. Instead, it’s more of an issue with the scope and definition of your data analysis project. It’s a human problem, not a mechanical one.

Different ways to apply greedy algorithms

There are a number of areas where greedy algorithms can most successfully be applied. In fact, it’s worth exploring some of these problems if you want to get to know them in more detail. They should give you a clearer indication of how they work, what makes them useful, and potential drawbacks.

Some of the best examples are:

 To learn more about other algorithms check out these articles:

To learn to implement specific algorithms, use these tutorials:

Co-editor of the Packt Hub. Interested in politics, tech culture, and how software and business are changing each other.


Please enter your comment!
Please enter your name here