First algorithm's pseudo code.

This algorithm is simplest and most trivial to think.