Source: https://www.math.kit.edu/ianm2/lehre/progjava2009w/seite/aktuelles/media/algorithmen.handout.pdf