Consider a recursive algorithm.