Source: http://www.lirmm.fr/~rouzeyre/PDF/CorrectionExercicesCodesCorrecteurs.pdf