Name: ________________________________

Honor Code Acknowledgment: ___________________


Random Quiz # 7

CPS 100, Spring 1996

Due: February 9


Problem 1: Palookaville (2 points)

Doubly-linked lists are defined as follows struct Node { string info; Node * next; Node * previous; }; Given a pointer to an internal node of the list (i.e., not necessarily the first or last node) the function below returns a count of the number of nodes in the list int Count(Node * list) { if (list == 0) return 0; else return 1 + Count(list->next) + Count(list->previous); } What is the complexity of Count (using big-Oh notation). Justify your answer briefly.









Problem 2: Mr. Robertson and Mr. Wells (3 points)

Solve the recurrence relation T(n) = 2T(n/2) + n^2. Show work.