Source: https://www.labri.fr/perso/maylis/AlgoSem2/supports/notes/algoINF102_2007.pdf