Source: https://www.cs.uic.edu/~ajayk/c301/CS301-UIC/Lecture-22-mapping-reductions.pdf