Coding an Algorithm