Source: https://profhofer.fr/index_files/Cours/3e/01_-_Algorithmique/3B.01 - CdT - Algorithmique.pdf