  Let $p(m)$ (respectively, $q(m)$) be the maximum number $k$ such that any
tree with $m$ edges can be transformed by contracting edges (respectively, by
removing vertices) into a caterpillar with $k$ edges. We derive closed-form
expressions for $p(m)$ and $q(m)$ for all $m \ge 1$. The two functions $p(n)$
and $q(n)$ can also be interpreted in terms of alternating paths among $n$
disjoint line segments in the plane, whose $2n$ endpoints are in convex
position.
