Name: ________________________________

Honor Code Acknowledgment: _____________________________


Random Quiz 6

CPS 100, Fall 1996

6 points

Due: November 5 (Election day)


Problem 1: How many older? (5 pts)

A binary tree node is represented by the following definition.

struct Node
{
   int age;        // age of a person
   Node * left;
   Node * right;
};
Write a recursive function called NumberTooOld that returns the number of people of who are older than a given "value" (that is, the number of nodes with age greater than "value").
int NumberTooOld(Node * T, int value)
// postcondition: returns the number of nodes in T whose
//       age is greater than "value"
{












}

Problem 2: How fast? (1 pt)

If a tree T has N nodes, what is the worst case running time (big-Oh) of your NumberTooOld function?