Anne Dawson: CSCI201A_HW2_FA04.htm   

 

Last updated: Friday 1st October 2004, 12:22 PT

 

This document is subject to change without notice.

 

Please report any errors or omissions in this document:

adawson@coquitlamcollege.com

 

Special instructions:  For this assignment you must work alone.

See schedule for due date.

 

 

CSCI201A

Data and Program Organization (Data Structures)

Fall 2004

Homework 2

Implementation of the Traversal Methods of a Binary Tree.

 

Step 1

 

 

Using your complete binary tree program of Lab 5, add extra functions to implement the four traversal methods: inorder, preorder, postorder and level order. Calling each of these methods from a driver program, display each of the integers contained in the nodes of the tree.

 

Step 2

 

Design an algorithm (the steps to solve the problem).

The following web page will help you design your algorithm and pseudocode:

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

 

Step 3

 

Development the pseudocode from your algorithm.

The following web page will help you design your algorithm and pseudocode:

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

 

Step 4

 

Using your pseudocode as a guide, implement your program in the C++ or Java language.

 

Your program should start with a comment block that contains the following information:

 

#  File:       hw2.cpp or hw2.java

#  Purpose:    Implementing the tree traversal methods

#  Programmer: [your name]   

#  Course:     CSCI201A

#  Date: 

#  Test data:

 

Step 5

 

Test your program by running supplying your own test data. You should test your program with at least 3 sets of test data. Show your test data and results in comments at the top of your program.

 

 

 

Program points will be based on the following marking scheme:

 

Marking Scheme:

CSCI201A   -   Lab 5  -  Implementation of the Traversal Methods of a Binary Tree.

Student name(s):

Category

Points

Description

Algorithm

15

An informal description of the steps that must be taken to solve the problem.

ref: http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Pseudocode

15

A formal description of the steps that must be taken to solve the problem.

http://www.coquitlamcollege.com/adawson/Pseudocode.htm

Comments

10

The program is commented appropriately.

Style

15

The source code should be indented properly, use meaningful variable names and identifiers, use good programming practices, etc. See the book, website and lectures for examples.

Output

10

Screen prompts and results should be user-friendly.

Correctness

15

The program should output correct results.

Completeness

10

The program should be complete.

Test

10

Comments in the code explain how the code was tested.