In Greedy Algorithm a gaggle of resources are recursively divided supported the utmost , immediate availability of that resource at any given stage of execution.
To solve a haul supported the greedy approach, there are two stages:
1. Scanning the list of things
These stages are covered parallelly during this Greedy algorithm tutorial, on target of division of the array.
To understand the greedy approach, you’ll need to have a working knowledge of recursion and context switching. This helps you to understand the thanks to trace the code. you’ll define the greedy paradigm in terms of your own necessary and sufficient statements.
Two conditions define the greedy paradigm.
* Each stepwise solution must structure a haul towards its best-accepted solution.
* it’s sufficient if the structuring of the matter can halt during a finite number of greedy steps.
GREEDY ALGORITHM ADVANTAGES
Greedy algorithms have several advantages :
● Simplicity: Greedy algorithms are often easier to elucidate and code up than other algorithms.
● Efficiency: Greedy algorithms can often be implemented and they are more efficiently than other algorithms.
● Greedy algorithms have several drawbacks:
● Hard to design: Once you’ve found the right greedy approach, designing greedy algorithms are often easy. However, finding the proper approach are often hard.
● Hard to verify: Showing a greedy algorithm is correct often requires a nuanced argument than the others.