Problem with nails

Hello everyone, I have to solve one problem and im unable to do it.
So lets say you have drawn a line on a board, and there are nails hammered in it. Each nail is in different location on that line. Each nail must be attached to other nail with string atleast once with minimum amount of string used. So lets say you have:
5 nails at locations:
1 3 4 9 10. So nail at 1 and 3 would be attached, then 3 and 4, and lastly 9 and 10, so total amount of string used would be: 4. Would really appreciate your help.
I would perhaps start thinking about for each of 3,4,9, which neighbour is nearest.
Topic archived. No new replies allowed.