https://courses.grainger.illinois.edu/cs466/sp2020/assignments/PS2.pdf