Question: 4.[20] Prim's algorithm for Minimum Spanning Tree (MST) and Dijkstra's algorithm for Shortest Paths are both greedy algorithms. The two algorithms proceed in quite similar,

 4.[20] Prim's algorithm for Minimum Spanning Tree (MST) and Dijkstra's algorithm

4.[20] Prim's algorithm for Minimum Spanning Tree (MST) and Dijkstra's algorithm for Shortest Paths are both greedy algorithms. The two algorithms proceed in quite similar, but in fact different steps. (a) Very briefly, state how the two algorithms are different? (You don't need to give the algo- rithms.) (b) Draw an example of 3-node weighted graph, so that Prim's and Dijkstra's algorithms give different results 5.[20] A Bucket-Sort algorithm and an example run are given below. BUCKET-SORT(A) 1, n length[A] 2, for i i to n 3. do insert Ali] into list BllnAli 4, for i 0 to n-1 5. do sort list Bi] with insertion sort 6. concatenate the lists Bo), Blu.. Bn-1 together in order 4269 5 72 6194 10 tb) (a) What are the conditions for the algorithm to work? (b) Given the conditions in (a), what's the algorithm's complexity in terms of "big-O" (c) Give a "bad instance" of 10 decimal numbers, for which this algorithm will perform poorly. (d) ) Notice line 5 of the algorithm. What is the reason we want to use insertion sort, instead of other sorting methods (for example, selection sort), here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!