Source: http://www.cs.cmu.edu/~lblum/flac/Lectures_pdf/Lecture3.pdf