

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a pointed shape. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Objective: To understand and implement Traveling Salesman problem using Nearest Neighborhood Algorithm. Introduction: Problem A traveling salesman has to travel through a bunch of cities in a loop, in such a way that the expenses on traveling are minimized. This is the infamous Traveling Salesman Problem (aka TSP ) problem it belongs to a family of problems, called NP-complete problem. It is conjectured that all those problems requires exponential time to solve them. In our case, this means that to find the optimal solution you have to go through all possible routes, and the numbers of routes increases exponentially with the numbers of cities. Formal Definition We are given a complete undirected graph G that has a nonnegative integer cost (weight) associated with each edge, and we must find a Hamiltonian cycle (a tour that passes through all the vertices) of G with minimum cost. Theory: In our case we have points in the plane (i.e. cities) and the cost of the traveling between two points is the distance between them. In other words, we have a map with cities, any two of which are connected by a direct straight road and we want to find a shortest tour for our poor traveling salesman, who "wants" to visit every city. Nearest Neighborhood Algorithm: These are the steps of the algorithm:
_1. start on an arbitrary vertex as current vertex.