Name: ________________________________

Honor Code Acknowledgment: ___________________


Random Quiz # 3

CPS 100, Spring 1996

Due: January 26


Problem 1 Spivey's Corners: (2 points)

Describe what the function Chop, shown below, does the parameter list (assume list is a "standard" struct for implementing linked lists of integers).

void Chop(Node * & list)
{
    if (list != NULL)
    {
        Chop(list->next);
        if (list->info % 2 == 0)
        {
            list = list->next;
        }        
    }
}

Problem 2 Babes In Toyland: (2 points)

Show how to change the code in Chop above so that nodes that are unlinked from the list are returned to the heap using delete.