Princeton Univ. datatypes solution