Source: https://www.lri.fr/~hivert/COURS/CFA-L3/04-Tris.pdf