answersLogoWhite

0

seen then.

Consider this example.

You are standing at a place p. You are to goto q. There are intermediate places C1,C2 ...

You want to minimize distance travelled.

Greedy Method of Solving

You don't want to try all intermediate places. You goto the nearest intermediate place. Why? You feel by going to the nearest intermediate place, you will minimize the distance to q.

Dynamic Programming

You try all the places, but you store the previous result. Eg: To reach C3 in minimum distance, you reached by C1. So you store C1. So if you want to go to C5, by C3, you will goto C1 then C3 and then check if going from C3 to C5 is nearest.

I would suggest you read Intro to Algorithms by CLRS to understand in greater detail.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Difference between greedy algorithm and dynamic programming?

the basic difference between them is that in greedy algorithm only one decision sequence is ever generated. where as in dynamic programming many decision sequences are generated.


What are the difference between greedy algorithm and dynamic programing?

A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage; instead a "greedy" choice can be made of what looks best for the moment.


What is the difference between greedy algorithm and Divide and Conquer?

greedy method does not give best solution always.but divide and conquer gives the best optimal solution only(for example:quick sort is the best sort).greedy method gives feasible solutions,they need not be optimal at all.divide and conquer and dynamic programming are techniques.


What is the similar property between dynamic programming and greedy approach?

Both are using Optimal substructure , that is if an optimal solution to the problem contains optimal solutions to the sub-problems


What is the difference between branch and bound and greedy method?

Branch and bound method is used for optimisation problems. It can prove helpful when greedy approach and dynamic programming fails. Also Branch and Bound method allows backtracking while greedy and dynamic approaches doesnot.However it is a slower method.


What is the minimum coin change problem and how is it typically approached in the field of computer science?

The minimum coin change problem is a mathematical problem where the goal is to find the fewest number of coins needed to make a certain amount of change. In computer science, this problem is typically approached using dynamic programming algorithms, such as the greedy algorithm or the dynamic programming algorithm, to efficiently find the optimal solution.


Is China a capitalist state in disguise?

Very much so. It is human nature to be greedy, and the obviously huge difference in the country between those of wealth and those in poverty attests to it.


How do you tell the difference between someone who is monetarily abused by their spouse and someone who is just greedy and selfish?

Wow, I have never heard of this abuse before, but I will try to answer the question. You do not tell a difference because there is none. Why even put an "abuse" label on it? A person who is greedy and selfish is going to spend the money on themselves regardless of their spouse's needs, causing the spouse to go without. I suppose it would then be sensible to label it "monetary abuse," but I would just leave it as being married to a greedy and selfish person.


What are the key differences between the Floyd-Warshall and Dijkstra algorithms for finding the shortest path in a graph?

The key difference between the Floyd-Warshall and Dijkstra algorithms is their approach to finding the shortest path in a graph. Floyd-Warshall algorithm: It is a dynamic programming algorithm that calculates the shortest path between all pairs of vertices in a graph. It is efficient for dense graphs with negative edge weights but has a higher time complexity of O(V3), where V is the number of vertices. Dijkstra algorithm: It is a greedy algorithm that finds the shortest path from a single source vertex to all other vertices in a graph. It is efficient for sparse graphs with non-negative edge weights and has a lower time complexity of O(V2) with a priority queue implementation.


Are mice greedy?

Yeah. They are greedy


Is Eminem greedy?

no eminem is not greedy...


Were greedy for more gold sentence or fragment?

The phrase 'were greedy for more gold' is a fragment. Who was greedy? Correct: The men were greedy for more gold. The miners were greedy for more gold.