cs401 sp2014 Synthesis of Trees and Gates problem