A good algorithm is like a good story: it has a clear beginning, middle, and end.