0% found this document useful (0 votes)
97 views

Universiti Pendidikan Sultan Idris: Danesh Kumar A/L Sures Kumar E20181022338 Moganaa A/P Krishnan E20181020463

This document contains an assignment for a discrete mathematics course with 6 questions. Question 1 involves using the nearest neighbour algorithm to find the total distance of a travelling salesman route between 5 cities. Question 2 does the same for 5 friend's houses. Question 3 uses the greedy algorithm on a weighted graph of 5 areas of an island nation. Question 4 uses the greedy algorithm to find the minimum time route between 5 subway stops. Question 5 uses Prim's algorithm to find the minimum spanning tree of a weighted graph. Question 6 also uses Prim's algorithm on a weighted graph of connections between 5 air conditioners.

Uploaded by

Arvind Ravee
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)
97 views

Universiti Pendidikan Sultan Idris: Danesh Kumar A/L Sures Kumar E20181022338 Moganaa A/P Krishnan E20181020463

This document contains an assignment for a discrete mathematics course with 6 questions. Question 1 involves using the nearest neighbour algorithm to find the total distance of a travelling salesman route between 5 cities. Question 2 does the same for 5 friend's houses. Question 3 uses the greedy algorithm on a weighted graph of 5 areas of an island nation. Question 4 uses the greedy algorithm to find the minimum time route between 5 subway stops. Question 5 uses Prim's algorithm to find the minimum spanning tree of a weighted graph. Question 6 also uses Prim's algorithm on a weighted graph of connections between 5 air conditioners.

Uploaded by

Arvind Ravee
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/ 11

Universiti Pendidikan Sultan Idris

Fakulti Sains dan Matematik

SMA 1034

Introduction To Discrete Mathematics

Group C

ASSIGMENT 2

Group Members :

NAME REGISTRATION NUMBER

DANESH KUMAR A/L SURES KUMAR E20181022338

MOGANAA A/P KRISHNAN E20181020463


Nearest Neighbour Algorithm (NNA)

Question 1
Table 1 show the places that Michael wanted visit.

Table1

a) Draw a weight graph corresponding to this situation

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

W = 72 + 75 + 92 + 192 + 205 + 49 + 289 + 607


W = 1581
Question 2
Amir is a University After so many month he went back to his hometown for semester break.
He wish to visit all his five friend’s house, they are Praveen, Kamarul, Lee, Ashveen and
Fitri.

Amir Praveen Kamarul Lee Ashveen Fitri

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

a) Draw a weighted graph corresponding to situation in 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

Gaussland 317 Burnside

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

Gaussland 317 Burnside

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.

DTC Arena Richiamo Scholar Suites Panggung


Coffee Percubaan
DTC - 8 10 15 5
Arena 8 - 10 5 7
Richiamo Coffee 10 10 - 20 15
Scholar Suites 15 5 20 - 11
Panggung Percubaan 5 7 15 11 -
Table 4
(a) Draw a weighted graph corresponding to situation in 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 /

W = (A-E) + (B-D) + (B-E) + (A-C) + (B-E)


W = 5 + 5 + 7 + 10 + 20
W = 47 Minutes
PRIM’s Algorithm

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.

Solution for Question 1 :


(a)

(c) Weight of Tree = (V7-V1) + (V1-A) + (V1-V6) + (V6-V2) + (V6-Z) + (Z-V5) +


(Z-V4) + (V4-V3)
=1+2+3+2+2+2+4+3
= 19
Question 6

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.

Weight of tree = (1-2) + (1-6) + (1-3) + (3-5)


= 1.78 + 4.42 + 4.78 + 4.07
= 15.05

You might also like