should this algorithm work?

Printable View