Question

The two minimum spanning tree algorithms and the Dijkstra’s algorithm to find shortest part are examples...

The two minimum spanning tree algorithms and the Dijkstra’s algorithm to find shortest part are examples of greedy algorithms.

a) Briefly describe what makes and algorithm a greedy algorithm. In other words, what are the characteristics of a greedy algorithm?

b) What greedy algorithm property Kruskal’s algorithm uses in finding the minimum spanning tree? Explain your answer

c) What greedy algorithm property Dijkstra’s algorithm uses in finding the shortest path? Explain your answer

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

For algorithms with a large search space, one way to appoximate the optimal solution is to define a metric for estimating the “goodness” of a solution in a particular subspace. A greedy algorithm chooses the subspace to search in based on this approximation, then chooses the subspace of that subspace based on the same approximation metric, and so on until you get a solution. Greedy algorithms are usually fast, but their solutions are not always optimal, and you need to take care to define a good metric so that you get a near-optimal solution or get the optimal solution most of the time.

b)

Kruskal’s Algorithm builds the spanning tree by adding edges one by one into a growing spanning tree. Kruskal's algorithm follows greedy approach as in each iteration it finds an edge which has least weight and add it to the growing spanning tree.

Algorithm Steps:

  • Sort the graph edges with respect to their weights.
  • Start adding edges to the MST from the edge with the smallest weight until the edge of the largest weight.
  • Only add edges which doesn't form a cycle , edges which connect only disconnected components.

c)

Djikstra used this property in the opposite direction i.e we overestimate the distance of each vertex from the starting vertex. Then we visit each node and its neighbours to find the shortest subpath to those neighbours.

The algorithm uses a greedy approach in the sense that we find the next best solution hoping that the end result is the best solution for the whole problem.

Add a comment
Know the answer?
Add Answer to:
The two minimum spanning tree algorithms and the Dijkstra’s algorithm to find shortest part are examples...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT