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

Assignment SMA

The nearest neighbor algorithm (NNA) is a greedy algorithm that can be used to find an approximate solution to the traveling salesman problem. It works by starting

Uploaded by

Arvind Ravee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
369 views

Assignment SMA

The nearest neighbor algorithm (NNA) is a greedy algorithm that can be used to find an approximate solution to the traveling salesman problem. It works by starting

Uploaded by

Arvind Ravee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Prim’s Algorithm

1. Construct the minimum spanning tree (MST) for the given graph using Prim’s Algorithm

Since all the vertices have been included in the MST, so we stop.

Now, Cost of Minimum Spanning Tree


= Sum of all edge weights
= 10 + 25 + 22 + 12 + 16 + 14
= 99 units
2. A company named Hilltons wanted to divided the electrical supply to all their blocks with minimum cost.
Start from point a.

The minimum cost is


units
Nearest Neighbor Algorithm

1. A full of time traveler visits counties in England such as Berkshire, Bristol, Cheshire, Cornwall,
Derbyshire and Essex. He planned to begin the journey and ends at Bristol. The traveler used taxi to
reach his respective destination. The estimated travel time, in minutes, on the taxi stops at each
counties is given in Table 1.

Berkshire Bristol Cheshire Cornwall Derbyshire Essex

Berkshire - 60 85 69 23 97

Bristol 60 - 42 61 69 98

Cheshire 85 42 - 55 34 81

Cornwall 69 61 55 - 67 54

Derbyshire 23 69 34 67 - 104

Essex 97 98 81 54 104 -

a) Draw a diagram based on Table 1.


b) Find the NNA.
Answers
a)
b) ꦀ Δ minutes
2. A group of scouts members wanted to deliver cupcakes to few houses A, B, C, D, E, and F. They
wanted to deliver the cupcakes as fast as they could. Suggest them a way to reach their destinations
with short time by referring the weighted graph (in minutes).

Δ Δ minutes
Greedy Algorithm
1. A group adventurist went to Village Camping Marina di Venezia for some adventure trips. At the
village, they found it has 5 checkpoints. So, they had a game between each other, who can reach all
the checkpoints earlier and also has reached to all checkpoints with prove. Use the greedy algorithm
to find a route and find the estimated time required to travel this route.

The weight of the circuit is


Δ ꦀ minutes
2. This a weighted graph of a family planned for a vacation. They wanted to visit all those 5 places as
they wished but they wanted the journey to be travelled in a short period. Use greedy method to help
them plan their trip.

The shortest period of travelling is


ꦀ hours
Universiti Pendidikan Sultan Idris

Fakulti Sains dan Matematik

SMA 1034

Introduction To Discrete Mathematics

Group C

Assignment 2

Group members :
Name Registration Number
SHATISHWARAN A/L E20181022465
NADERAJAN
BARAN RAO AHNUMANTHU E20181020553
RAO

You might also like