Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
Greedy Method

# Greedy Method

Ratings:

4.5

(4)
|Views: 16,838|Likes:

Categories:Types, School Work

### Availability:

See More
See less

05/27/2013

original

unit51
Greedy Algorithm
Lecturer notes is purely design and developed byEr. Mohd. Arif Siddique
Lecturer Dept. of Computer Science & ITRGEC, Meerut

Unit 3 Greedy Algorithms2
General form of Greedy Algorithms
Algorithm greedy (C)//C is an input set having n element{S

// S is a solution setwhile not solution (S) and C

dox
extract best element from C.if (x is feasible)Then C
C - {x}// extract X from input set CS
S
{x}// add X into solutionif solution (S) =

then return “no solutions”
}
Time complexity excluding sorting:
O
(
n
)

Unit 3 Greedy Algorithms3
A Greedy Algorithm
A
greedy algorithm
always makes the choice that looks best at themoment.
In dynamic programming, the optimal solution is described in a recursivemanner, and then is computed ``bottom-up''. Dynamic programming is apowerful technique, but it often leads to algorithms with higher thandesired running times.
An alternative design technique, called greedy algorithms. This methodtypically leads to simpler and faster algorithms, but it is not as powerfulor as widely applicable as dynamic programming.
The greedy concept make the choice that looks best at the moment inthis hope that local optimal choices lead to global optimal solution
Even when greedy algorithms do not produce the optimal solution, theyoften provide fast heuristics (non-optimal solution strategies), and areoften used in finding good approximations.

## Activity (19)

### Showing

AllMost RecentReviewsAll NotesLikes