Modified 3sat algorithm for CS125 pset 10