This problem and the problems before it were a bit of a pain. I spent a good bit of time tracing through the paragraphs of description without really gaining any insight into what was going on. It might be better to just pseudocode a more general version of the algorithm for them.