Code used in Coursera BioAlg 1