0% found this document useful (0 votes)
127 views5 pages

Or in Education - Prim's and Kruskal's Algorithm Answer Sheet

The document contains sample problems and solutions for finding minimum spanning trees using Prim's and Kruskal's algorithms on various graphs. Prim's algorithm is used to find the minimum spanning tree connecting 6 towns with 166 km of cable required. Kruskal's algorithm finds a minimum spanning tree connecting some towns with a total length of 560 km. Mixed algorithm questions apply both Prim's and Kruskal's to graphs with node connections listed in order and total distances provided.

Uploaded by

aiden.tonthat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views5 pages

Or in Education - Prim's and Kruskal's Algorithm Answer Sheet

The document contains sample problems and solutions for finding minimum spanning trees using Prim's and Kruskal's algorithms on various graphs. Prim's algorithm is used to find the minimum spanning tree connecting 6 towns with 166 km of cable required. Kruskal's algorithm finds a minimum spanning tree connecting some towns with a total length of 560 km. Mixed algorithm questions apply both Prim's and Kruskal's to graphs with node connections listed in order and total distances provided.

Uploaded by

aiden.tonthat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Prim’s & Kruskal’s Algorithms

Answer Sheet

Kruskal’s algorithm

B
8
6 C
2
3
F
5
A
5
4 3
6

E 2 D

Question 1
Using Kruskal’s algorithm, identify the minimum spanning tree.

C
2
3
F
5
A
3

E 2 D

Question 2
What is the total length of the minimum spanning tree?

 15
Question 3
Using Kruskal’s algorithm, identify the minimum spanning tree between the towns.

Question 4
What is the total length of the minimum spanning distance?

 560
Prim’s algorithm questions
The network shown below shows the distances (in km) between some towns.

A cable television company wishes to link the towns shown as efficiently as possible (i.e.
using as little cable as possible). Suppose our starting node is A.

A 44 B

24
26 31
40 D
C 48
34
29 37

E 50
F

Question 5
Using Prim’s algorithm, in what order are the other nodes connected to the spanning tree?

 A, C, E, D, B, F

Question 6
What is the minimum amount of cable required to connect these 6 towns?

 166km
Consider the network given here. Suppose we started at vertex F. Use Prim’s algorithm to
find a minimum spanning tree.

B
9

2 6 C
3
5
A
F
7
4 3
7

E 2 D

Question 7
In what order are the other nodes connected to the spanning tree?

 F, C, D, E, A, B or
 F, D, E, A, B, C

Question 8
What is the total weight of the minimum spanning tree?

 F, C, D, E, A, B = 21
 F, D, E, A, B, C = 23
Mixed algorithm questions
A cable TV company is installing a system of cables to connect all the towns in a region. The
numbers in the network show distances in miles.

20 19

D 12
B
10 15
12 13

F C
8 E 14

Question 9
Starting at A, use Prim’s algorithm to determine the order of the nodes connected to the
spanning tree.

 AB BD DF FE BC

Question 10
What is the total length of the tree?

 62 miles

Question 11
Use Kruskal’s algorithm to determine the order of the nodes connected to the spanning tree.

 FE FD DB BC AB

Question 12
What is the total length of the tree?

 62 miles

Question 13
What do you notice about the two trees?

 The trees end up the same, but the order of the nodes is different. Writing down the
order as you select the nodes is important as it shows your working.

You might also like