Source: http://www.maths-info-lycee.fr/pdfs/ts_algorithmique.pdf