4.1 Algorithm