Algorithm studied during the course of Algoritmica2 at the Unipi Computer Science Master Degree