CS2141 Quiz 2

Due: Wednesday, 9 June 2010, at 11:05am

Setup

Download the files prog2.cpp, binarytree.h, binarytree.cpp, and Makefile.

Together, these four files make up an apparently working solution to the Spring 2010 version of Program 2. They should compile correctly using the command make.

Problem Description

The binary tree I've given you contains three major (memory) bugs. Your task is to (a) identify the bugs and (b) fix them.

Identifying Bugs

You are welcome to use Valgrind, GDB, or any other debugging tools of your choice (including none at all) for this quiz. However, you ABSOLUTELY MAY NOT colaborate with other students.

Once you have found a bug, place a comment in the code describing the nature of the bug. Your comment should have the following form:

// BUG FOUND
// Original code used delete instead of delete[]

The comment should indicate the location of the bug, and show be that you've identified what's wrong. You don't need more than a line or two.

Fixing Bugs

Having located the bug, add in sufficient code to fix it. None of the bugs require more than three or four lines of new code, and two require only one line each to fix them. Some thought will be required to identify how to fix the bugs, however.

Submission Details

When you are satisfied with your fixes to the code, submit all four files using submit. It has been configured to expect all four.

Grading

This quiz is worth 30 points. You'll received five points per bug identified, and an additional five per bug fixed. The code should be otherwise bug free, but I will award bonus points if you manage to find other problems with the code.

Hints

This page last updated 4 June 2010