// AP Computer Science, AB Exam, 1996, Question 3, part A in C++ bool ValsLess(TreeNode * t, int k) //postcondition: returns true if t is NULL or if // all values stored in tree represented // by t are less than k; otherwise // returns false { if (t == NULL) return true; // empty tree? return t->info < k && ValsLess(t->left,k) && ValsLess(t->right,k); }