Universiti Pendidikan Sultan Idris: Danesh Kumar A/L Sures Kumar E20181022338 Moganaa A/P Krishnan E20181020463
Universiti Pendidikan Sultan Idris: Danesh Kumar A/L Sures Kumar E20181022338 Moganaa A/P Krishnan E20181020463
SMA 1034
Group C
ASSIGMENT 2
Group Members :
Question 1
Table 1 show the places that Michael wanted visit.
Table1
Oxford Brighton
120
Manchester Bristol
249
192
607
London 75 Cambridge
208
286
Liverpool Glasgow
b) Use the nearest neighbour algorithm to find an approximate solution to the travelling
salesman problem for a circuit starting at the Brighton position, and find the angular
change when traveling this circuit.
Oxford Brighton
120
Manchester Bristol
249
192
607
London 75 Cambridge
208
286
Liverpool Glasgow
Amir -------- 30 25 15 5 10
Praveen 30 -------- 30 45 55 17
Kamarul 25 30 -------- 20 5 2
Lee 15 45 20 -------- 10 6
Ashveen 5 55 5 10 -------- 30
Fitri 10 17 2 6 30 --------
Table 2
Amir Praveen
30
45
Fitri 2 Kamarul
10
Ashveen Lee
b) Use the nearest neighbour algorithm to find a route, and find the estimated time
required to travel this route.
Amir Praveen
30
45
Fitri 2 Kamarul
10
Ashveen Lee
W = 5 + 5 + 2 + 6 + 45 + 30
W = 93
Greedy Algorithm
Question 3
Table 3 show the State of the Island Nation of Mathland. Charles and his family would like to
visit the whole island in 2 days. They would love to find the shortest route so they would able
to visit all the areas in the Island.
Coulombia Burnside Leibniz Heavisidia Gaussland
Coulombia ----------- 142 153 234 435
Burnside 142 ----------- 181 396 317
Leibniz 153 181 ----------- 248 80
Heavisidia 234 369 248 ----------- 136
Gaussland 435 317 80 136 -----------
Table 3
I. Draw the weight graph corresponding to the situation. Use the alphabetical order.
Coulombia
248
Heavisidia Leibniz
II. Use the greedy algorithm to find an approximate solution to the traveling salesman
problem and find the total angular change when traveling this circuit.
Coulombia
248
Heavisidia Leibniz
✓ 80
✓ 136
✓ 142 W = 80 + 136 + 142 + 153 + 234 +369
✓ 153 W = 1114
181
✓ 234
248
317
✓ 369
435
Question 4
SMK Dato Haji Kamaruddin, Kuala Kubu Baru wants to visit Sultan Idris Educational
University. The estimated travel time, in minutes, on the Sultan Idris Educational School
subway between each of the stops is given in the Table 4.
(b) Use the greedy algorithm to find a route, and find the estimated time required to
travel this route.
Answer :
(a)
(b)
5 /
5 /
7 /
8 ×
10 /
10 ×
11 ×
15 ×
15 ×
20 /
Question 5
Use PRIM’s Algorithm to (a) find minimum spanning tree for the given weighted graph and
(b) find the weight of this tree.
Five Air Conditioner in Sri Tanjong Hall, Sultan Idris Educational University which labelled
1, 2, 3, 4 and 5 must be connected with cable. The cost of connecting each pair of lamp by
cable is given in the table 5.
1 2 3 5 6
1 - 1.78 4.78 8.82 4.42
2 1.78 - 6.14 10.02 6.14
3 4.78 6.14 - 4.07 4.94
5 8.82 10.02 4.07 - 8.38
6 4.42 6.14 4.94 8.38 -
Table 5
(a) Draw a weighted graph corresponding to situation in Table 5.
(b) Use the greedy algorithm to find a route, and find the estimated time required to
travel this route.