CSC 148 H1, Winter 2013

Lab 6 (Feb. 26/27)

This document contains the instructions for lab number 6 in CSC 148 H1. To earn your lab mark, you must actively participate in the lab.
We mark you in order to ensure a serious attempt at learning, NOT to make careful critical judgments on the results of your work.

General rules

We will use the same general rules as for the first lab (including pair programming). See the instructions at the beginning of Lab 1 to refresh your memory.

Overview

In this lab, you will write code to perform a few basic operations on general tree structures.

We have discussed general tree structures in lectures, but this lab is where you will work to understand exactly how to represent and manipulate these structures in a program. Until you do this, you cannot truly say that you "understand" trees.


Trees

Step 1: Creation

(Student s1 drives and student s2 navigates.)

When you are done, show your work to your TA and switch roles.

Step 2: Visualization

(Student s2 drives and student s1 navigates.)

When you are done, show your work to your TA and switch roles.

Step 3: Contains

(Student s1 drives and student s2 navigates.)

When you are done, show your work to your TA and switch roles.

Step 4: Branching

(Student s2 drives and student s1 navigates.)

When you are done, show your work to your TA.

Challenge!

Once all of your methods work properly, try to make your code as concise as possible. It is possible for the body of every method (except for the constructors) to consist of a single if/else statement or a single return statement, by making appropriate use of list comprehensions...