Greedy Algorithm

Go to Problems

What is Greedy Algorithm?

What is Greedy Algorithm?

  • A greedy algorithm is a simple and efficient algorithmic approach for solving any given problem by selecting the best available option at that moment of time, without bothering about the future results.
  • In simple words, here, it is believed that the locally best choices made would be leading towards globally best results.
  • In this approach, we never go back to reverse the decision of selection made which is why this algorithm works in a top-bottom manner.
  • Advantages of Greedy Approach:
    • It is easier to describe.
    • It can perform better in most of the scenarios than other algorithms.
NOTE: We have mentioned “in most of the scenarios” in the earlier point because in some cases, this approach doesn’t always produce correct results due to the nature of not reversing the decision made.
This is why we opt for Dynamic Programming strategy in such scenarios.

Serious about Learning Programming ?

Learn this and a lot more with Scaler Academy's industry vetted curriculum which covers Data Structures & Algorithms in depth.

Greedy Algorithm Problems

Easy greedy
Problem Score Companies Time Status
Highest Product 200 29:25
Bulbs 200
23:18
Disjoint Intervals 200
47:18
Largest Permutation 250 53:54
lock
Topic Bonus
Bonus will be unlocked after solving min. 1 problem from each bucket