Computer Science 61B - Spring 1994 - Clancy - Midterm 2

Computer Science 61B - Spring 1994 - Clancy - Midterm 2 -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
midterm Midterm #2 Spring 1994, 61B Problem 0 Problem 1 Problem 2 Problem 3 Login name: __________________ Problem 0 (1 point, 1 minute) Put your login name on each page. Also make sure you have provided the information requested on the first page. You will lose this point if any of this information is missing. Background for problems 1 and 2 Given below is the definition of a class for a tree of integers similar to the tree of strings you used for homework assignment 8. class Tree { private: int value; Tree* left; Tree* right; public: Tree ( ); int Value ( ); Tree* Insert (int); file:///C|/Documents%20and%20Settings/Jason%20Raft. ..20Spring%201994%20-%20Clancy%20-%20Midterm%202.htm (1 of 5)1/27/2007 6:31:32 PM
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
midterm void InitGenerator ( ); Tree* Next ( ); }; Problems 1 and 2 involve a function that acts like a tree destructor function. Problem 1 (4 points, 8 minutes) Write a recursive function that, given a pointer to a Tree object, deletes the object and every object in the tree's subtrees. You may but need not code this as a destructor for the Tree class. Also indicate what changes to the Tree class definition are necessary for your function to compile without errors.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2009 for the course CS 61B taught by Professor Canny during the Spring '01 term at University of California, Berkeley.

Page1 / 5

Computer Science 61B - Spring 1994 - Clancy - Midterm 2 -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online