Source: https://www.math.univ-tours.fr/files/semaine1_algo.pdf