Greedy
A Greedy Algorithm chooses the best local option
Last updated
Was this helpful?
A Greedy Algorithm chooses the best local option
Last updated
Was this helpful?
A Greedy Algorithm always takes the best possible local option available.
A Greedy algorithm is very useful when choosing between clear right and wrong choices that do not change throughout the algorithms completion.
Choosing a career based on total salary
Choosing a meal based on the biggest size
Choosing a product based on price
Choosing a career based on happiness
Choosing a meal based on taste
Choosing a product based on quality
The wall street trading bot is using a simple Greedy algorithm which is: Buy Low & Sell High. With this greedy algorithm the trading bot plans to maximize profit. To give the bot a chance against all of the wall street "Bulls". The bot will be given the next five days of stock prices for a specific company.
Stock prices for the next 5 days
$11, $8, $18, $4, $12
Buy Today
if the Price Increases Tomorrow
Sell Today
if the Price Decreases Tomorrow
Next 5 Days = $11, $8, $18, $4, $12
$11 = Nothing
$08 = Buys
$18 = Sells
$04 = Buys
$12 = Sells
Profit = 18-8 + 12-4 = $16
The Greedy algorithm is trying to beat the Super Mario game as fast as possible. The algorithm must obey the rules we set. Algorithm Rules:
Mario always runs forward
Mario always jumps on or over enemies
Mario always jumps over obstacles
The greedy part of the algorithm is always "greedily" moving forward, this was chosen because it seems to be the fastest way to complete the level.
Simple strategy
Easy to implement
Mario will complete levels fast
Mario will Not find
Secrets
Bonus content
Faster solutions are possible with shortcuts
Unforeseen circumstance can make the game unbeatable
Unique enemy (Bowser)
Can Not defeat using normal jump attacks
Unique level (Swim)
Can Not navigate using normal controls
Unique puzzle (collect keys)
Can Not win without doing something
Greedy will work
Greedy will Not work
Trading Algorithm
Sample Trading
Transaction Logs of Bot
This strategy is the best possible option for this problem but can break down on different types of problems
Good
Bad
Ugly
A Greedy Algorithm can be short sighted