Compute the convex hull of all points and let its area be .
If the convex hull is a segment, sort the points lexicographically by and output that order. Now suppose the convex hull has positive area.
Set the strip spacing to and let . Use the following two horizontal grids: and , where is an integer.
For each grid, build one candidate tour as follows.
Compute the lengths of the two candidate tours and output the shorter one. The convex hull and its area can be computed in time, so the whole algorithm runs in time.
Proof
Let , , and be the horizontal width, perimeter, and diameter of the convex hull. We have .
Fix one grid. Project every point vertically onto its assigned horizontal line. Expand the convex hull upward and downward by . Every projected point lies inside the expanded convex body. Its area is , its perimeter is , and its diameter is at most .
Solution written by GPT5.6
Imagine traversing every horizontal segment obtained by intersecting the expanded body with a grid line. Move from bottom to top, traversing one segment from left to right and the next from right to left. Connect the endpoints of consecutive segments on the same side by a straight segment. Such a segment is no longer than the corresponding boundary arc of the convex body. Therefore, the total cost of connecting consecutive horizontal segments is at most , and closing the walk costs at most .
Whenever the walk reaches a projected point, make a round trip to the original point. After all points have been visited, shortcut auxiliary points using the triangle inequality. The tour produced by the algorithm is no longer than this auxiliary walk.
The two grids are shifted by . For every point, the sum of its distances to the nearest line of the first grid and the nearest line of the second grid is . Hence the average round-trip cost from the grid lines to the original points is over the two candidates.
Let be the horizontal cross-section length of the expanded convex body at height . The union of the two grids is a grid with spacing . By convexity, first increases and then decreases, so its total variation is at most . Bounding the difference between the Riemann sum on this grid and the integral by the total variation shows that the average horizontal movement of the two candidates is at most .
Therefore, one of the two candidates has length satisfying
Since , the first two terms sum to . For a planar convex body of diameter , we have , , and . Also, gives . Thus
If the convex hull is a segment, the lexicographic order gives a tour of length at most , so the same bound holds.