0% found this document useful (0 votes)
10 views3 pages

Greedy Method

Uploaded by

hiralrathod2710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Greedy Method

Uploaded by

hiralrathod2710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Greedy method (is a technique)

 Simple and straight forward approach.


 The decision is taken on basis of content availability. Without worrying
about the effect of current decision in future.
 This technique is feasible (any subset that satisfy the condition) solution that
may or may not optimal (best and most favorable).

Greedy Algorithm

The greedy method is one of the strategies like Divide and conquer used to solve
the problems. This method is used for solving optimization problems. An
optimization problem is a problem that demands either maximum or minimum
results. Let's understand through some terms.

The Greedy method is the simplest and straightforward approach. It is not an


algorithm, but it is a technique. The main function of this approach is that the
decision is taken on the basis of the currently available information. Whatever the
current information is present, the decision is made without worrying about the
effect of the current decision in future.

This technique is basically used to determine the feasible solution that may or may
not be optimal. The feasible solution is a subset that satisfies the given criteria. The
optimal solution is the solution which is the best and the most favorable solution in
the subset. In the case of feasible, if more than one solution satisfies the given
criteria then those solutions will be considered as the feasible, whereas the optimal
solution is the best solution among all the solutions.

Characteristics of Greedy method

The following are the characteristics of a greedy method:

1. To construct the solution in an optimal way, this algorithm creates two sets
where one set contains all the chosen items, and another set contains the
rejected items.
2. A Greedy algorithm makes good local choices in the hope that the solution
should be either feasible or optimal.

Components of Greedy Algorithm


The components that can be used in the greedy algorithm are:

o Candidate set: A solution that is created from the set is known as a


candidate set.
o Selection function: This function is used to choose the candidate or subset
which can be added in the solution.
o Feasibility function: A function that is used to determine whether the
candidate or subset can be used to contribute to the solution or not.
o Objective function: A function is used to assign the value to the solution or
the partial solution.
o Solution function: This function is used to intimate whether the complete
function has been reached or not.

Applications of Greedy Algorithm

o It is used in finding the shortest path.


o It is used to find the minimum spanning tree using the prim's algorithm or
the Kruskal's algorithm.
o It is used in job sequencing with a deadline.
o This algorithm is also used to solve the fractional knapsack problem.

Advantages and Disadvantages of Greedy Approach


Advantages

 Greedy approach is easy to implement.


 Typically have less time complexities.
 Greedy algorithms can be used for optimization purposes or finding close to
optimization in case of NP Hard problems.

Disadvantages

 The local optimal solution may not always be global optimal.

You might also like