18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Lecture 1 - analyzing algorithms<br />

You are given the job to program the robot arm. Give me an algorithm to find the best tour!<br />

Listen To Part 1-10<br />

Nearest Neighbor Tour<br />

A very popular solution starts at some point and then walks to its nearest neighbor first, then repeats from ,<br />

etc. until done.<br />

Pick and visit an initial point<br />

i = 0<br />

While there are still unvisited points<br />

Return to from<br />

i = i+1<br />

Let be the closest unvisited point to<br />

Visit<br />

This algorithm is simple to understand and implement and very efficient. However, it is not correct!<br />

file:///E|/LEC/LECTUR16/NODE1.HTM (3 of 9) [19/1/2003 1:34:15]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!