Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Given the following edge - weighted graph: 6 1 5 0 - 1 1 . 3 0 - 2 5 . 2 0

1. Given the following edge-weighted graph:
615
0-11.3
0-25.2
0-32.1
0-46.8
0-53.5
1-25.6
1-32.0
1-46.9
1-53.6
2-35.7
2-46.1
2-56.0
3-47.0
3-55.1
4-57.8
a) Show a trace of the execution of Kruskal's Algorithm on this graph. Your trace should be in the style of the trace shown on page 624 of the text. [5]
b) How many elements are inserted into the priority queue used by Kruskal's algorithm when computing the MST for this graph? [1]
c) How many elements of the priority queue do you consume before the algorithm completes computing the MST?[1]
d) Show a trace of the execution of the eager version of Prim's Algorithm on this graph. Your trace should be in the style of the trace shown on page 621 of the text. [5]
e) As Prim's algorithm executes, how many elements of each of the edgeTo[] and distTo[] arrays must be updated each time an edge is added to the MST?[1]
e) Which of the two algorithms is a better choice for computing the MST for this graph? Why? [2]
2. Given the following edge-weighted graph:
68
0-14.1
0-24.5
1-22.1
2-33.5
2-44.8
2-52.4
3-43.9
4-53.7
a) Show a trace of the execution of Kruskal's Algorithm on this graph. Your trace should be in the style of the trace shown on page 624 of the text. [5]
b) How many elements are inserted into the priority queue used by Kruskal's algorithm when computing the MST for this graph? [1]
c) How many elements of the priority queue do you consume before the algorithm completes computing the MST?[1]
d) Show a trace of the execution of the eager version of Prim's Algorithm on this graph. Your trace should be in the style of the trace shown on page 621 of the text. [5]
e) Contrast the amount of work Prim's algorithm has to do for this graph and the graph in the previous question when updating the edgeTo and distTo arrays. [1]
f) Which of the two algorithms is a better choice for computing the MST for this graph? Why? [2]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions