Consider writing a pseudo-code description of this algorithm and note its loop structure.