# Homework Help: Nearest neighbor and cheapest link algorithm

1. Jun 20, 2007

### SamTsui86

1. The problem statement, all variables and given/known data

I need to calculate the relative error of the nearest neighbor algorithm. The book says it is the difference between the worst and nearest neighbor solution to the nearest neighbor solution. Does the mean that for example I have CITY A, find the fastest way to back to city A while reaching all the vertex and find the longest way back to city A while reaching all the vertex. Then I take the difference and divide it by the shortest way?

Can anyone explain how to do the cheapest link algorithm:
My professor told me is
1) Pick the link with the smallest weight
2) Pick the next cheapest link
3) Contine picking the cheapest link availabe
4) Close the circuit

I am very confuse with his step, how do I close the link???? How is that different from the nearest neighbor algorithm??

Thank You

2. Relevant equations

3. The attempt at a solution