Lec7 Greedy Approach
Lec7 Greedy Approach
Or
Greedy Approach
LECTURE 07
BY ENGR. SEEMA BUGHIO
Greedy Algorithms
Greedy algorithms are a class of algorithms that make locally optimal choices at each step
with the hope of finding a global optimum solution. In these algorithms, decisions are made
based on the information available at the current moment without considering the
consequences of these decisions in the future. The key idea is to select the best possible
choice at each step, leading to a solution that may not always be the most optimal but is often
good enough for many problems.
Example
Problem: Suppose we have to travel from A to B.
Condition: within 12hr S1: by walk
S2: by bike
S3: by car
S4: by train
S5: by flight
Optimization problems are problems which demands or which requires either maximum
result or minimum result.
Greedy method is about solving optimization problems.
There are more approaches to solve Optimization problems :
Greedy method
Dynamic programming
Branch and bound
Greedy Method
Greedy Approach In Real-life ….!
Route planning: GPS navigation systems use Greedy algorithms to find the shortest route between two
points, choosing the next step based on the shortest distance.
Resource allocation: In project management, resources are allocated to tasks based on their priority and
availability, using a Greedy approach to maximize efficiency.
Scheduling: When scheduling tasks or appointments, you might use a Greedy approach to prioritize the
most important or urgent tasks first.
Packing: When packing items into boxes or containers, you might use a Greedy approach to pack the
largest or heaviest items first.
Algorithms Follow Greedy Approach….!
UPDATED:-
Dijkstra's algorithm
Dijkstra's algorithm
Dijkstra's algorithm
UPDATED:-
Dijkstra's algorithm
Dijkstra's algorithm
Dijkstra's algorithm
UPDATED:-
Dijkstra's algorithm
Dijkstra's algorithm
UPDATED:-
Dijkstra's algorithm
Dijkstra's algorithm
UPDATED:-
Dijkstra's algorithm
Dijkstra's algorithm
Dijkstra's algorithm
Time Complexity
0(V-1)
0(V)
0(1)
v.Log v
E.logv
THANK YOU