Easy Algorithms Greedy Algorithms
What is a greedy algorithm and give an example?
Answer
A greedy algorithm makes the locally optimal choice at each step with the hope of finding a global optimum. It never reconsiders previous choices. Example: Coin change with denominations [25,10,5,1] - always pick the largest coin that doesn't exceed remaining amount. Works for standard denominations but not all cases (e.g., [1,3,4] making 6). Greedy algorithms are efficient but don't always yield optimal solutions.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Algorithm Developer