Source: http://www.info.univ-angers.fr/~basseur/Algo/introAlgo1314.pdf