Source: https://michel.stainer.pagesperso-orange.fr/PSIx/Informatique/Cours/Ch2-Tris.pdf