https://www.mi.fu-berlin.de/wiki/pub/ABI/AlgLecture8MaterialsWS14/script.pdf