Source: http://ww2.ac-poitiers.fr/math/IMG/pdf/algorithmique.pdf