Source: https://people.cs.umass.edu/~elm/Teaching/ppt/370/370_4.pptx.pdf