Source: http://mpsi.daudet.free.fr/maths/polys/cours/Algorithme/Algorithme.pdf