0-1 Knapsack Problem (Greedy Algorithm)
0-1 Knapsack Problem (Greedy Algorithm)
Presented by : Presented to :
Muskaan Ms. Pooja Jha
Swati Rani
Introduction
Greedy is an algorithmic paradigm that builds
up a solution piece by piece, always choosing
the next piece that offers the most obvious
and immediate benefit.
So the problems where choosing locally
optimal also leads to global solution are best
fit for Greedy.
A Greedy algorithm works if a problem
exhibits the following two properties :
1. A candidate set
2. A selection function
3. A feasibility function
4. An objective function
5. A solution function
Pros
Finding solution is quite easy with Greedy algorithm
for a problem
Analyzing the run time for Greedy algorithms will
generally be much easier than for other
techniques(like Divide and conquer)
Cons
It is not suitable for problems where a solution is
required for every sub problem like sorting
In such problems, the Greedy strategy can be wrong
; in worst case even lead to a non-optimal solution
0-1 Knapsack Problem