3.4 Algorithm