1. Defining algorithms