I'll need a walkthrough of this algorithm.