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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Lecture 1 - analyzing algorithms<br />

Always starting from the leftmost point or any other point will not fix the problem.<br />

Listen To Part 1-11<br />

Closest Pair Tour<br />

Always walking to the closest point is too restrictive, since that point might trap us into making moves we don't want.<br />

Another idea would be to repeatedly connect the closest pair of points whose connection will not cause a cycle or a<br />

three-way branch to be formed, until we have a single chain with all the points in it.<br />

Let n be the number of points in the set<br />

For i=1 to n-1 do<br />

For each pair of endpoints (x,y) of partial paths<br />

If then<br />

Connect by an edge<br />

Connect the two endpoints by an edge.<br />

Although it works correctly on the previous example, other data causes trouble:<br />

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

, , d = dist(x,y)

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

Saved successfully!

Ooh no, something went wrong!