Greedy Search
Greedy Search
Search
Section - B , Sem 5 , Group 1
24 / 12 / 2024
Page 01
Table of Content
My Team
About the algorithm
How do the Algorithms execute
Where these Algorithms are applied
Advantages and Disadvantages
Conclusion
Page 02
Our Team
Page 03
Our Team
Myo Hay Mann Naing Myat Myat Tun Aye Myat Nyein
ThaNaTa - 2002 ThaNaTa - 1971 ThaNaTa - 1970
Page 04
What is Heuristic Function?
Page 05
Greedy Search?
A greedy search is an informed search algorithm that uses a heuristic
function to decide which node to explore next.
The algorithm evaluates nodes based on the heuristic value, h(s), and selects
the node that appears closet to the goal.
Page 06
In Choosing A Job
Imagine you are evaluating two job offers to maximize career growth.
• Goal: Achieve the best career growth.
• Heuristic h(s) : Growth potential of each job (e.g., skill development opportunities).
• Job A: Offers a slightly higher salary but fewer opportunities for skill growth.
• Job B: Provides lower pay but significant opportunities for skill-building and networking.
Greedy Search evaluates f(s) = h(s) for both jobs and selects Job B because it has higher
growth potential (smaller heuristic value).
However, this approach may overlook long-term benefits from Job A, as it does not consider
the overall cost or impact.
Page 07
How do the 2024
Algorithm Execute
Initialize a tree with the root node being the start node in
the open list.
Go to the node with the lowest h(x) value from the open list
for exploration.
Page 08
Consider finding the path from P to S in the following graph: 2024
Page 09
2024
Page 10
2024
C has the lowest cost of 6. Therefore, the search will continue like so:
Page 11
U has the lowest cost compared to M and R, so the search will
2024
continue by exploring U. Finally, S has a heuristic value of 0 since that
is the target node:
Page 12
The total cost for the path (P -> C -> U -> S) evaluates to 11. The potential problem with
2024
a greedy best-first search is revealed by the path
(P -> R -> E -> S) having a cost of 10, which is lower than (P -> C -> U -> S). Greedy best-
first search ignored this path because it does not consider the edge weights.
Page 13
2024
Real-life
Applications Of
Greedy Algorithm
Page 14
Score collection
game
-A player collects score on a grid, and the objective is to maximize the total
score collected in a fixed number of moves.
Starting point-the top-left corner (5)
Rules-Move to adjacent cells (right, left, up, or down)
Fixed number of moves-4
5 1 15 5 1 15
2 10 0 2 10 0
3 6 2 3 6 2
5-->2-->10-->6-->3(score=26) 5-->1-->15-->0-->10(score=31)
1. Local Optimization:
At each decision point, the algorithm selects the action that maximizes the immediate
payoff or benefit.
No effort is made to plan for the future or consider the opponent's potential responses.
2. No Lookahead:
Ignores the long-term consequences of decisions. They base decisions only on the
current state.
3. Applications:
The greedy algorithm is efficient and effective for quick decision-making in simple cases.
So,they are often used in simple games or as a baseline strategy for comparison.
Page 16
For pathfinding, such as in GPS navigation
systems;
Page 17
Resource Allocation (e.g., Task Scheduling)
Greedy algorithms are used in scheduling tasks, especially in scenarios like job
scheduling or task allocation to machines in cloud computing.
Page 18
How Greedy Algorithms Work in NLP
Steps
1. Tokenization:
2. Applying Grammar Rules:
3. Building a Parse Tree:
4. Validation:
Page 19
How Greedy Algorithms Work in NLP
Page 20
2024
Advantages of
Greedy Search
Simple and Easy to Fast and Efficient: Low Memory Flexible: Efficiency:
Implement: Requirements:
can be adapted to how close a node is
requires only a
a relatively a very fast algorithm, different types of to the solution, this
small amount of
straightforward ideal for applications problems algorithm can be a
memory, easily extended to
algorithm where speed is very efficient
suitable for more complex find a solution
making it easy essential.
applications with problems. quickly, even in
to implement.
limited memory. large search spaces.
Page 21
2024
Disadvantage of
Greedy Search
Page 22
2024
Conclusion
Greedy search algorithms are efficient
and simple, making locally optimal
choices to solve problems quickly
Page 23
Thank
You.
Any Question ?
Page 24