This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 2
Assignment 5
18 April 2001
Due: Wednesday, April 25 at 11:59 p.m.
Late penalties: 20 points per partial day late. That is, programs
turned in after 11:59 p.m. Wednesday and before 11:59 p.m. Thursday
will have 20 points deducted for late. Programs turned in after
11:59 p.m. Thursday and before 11:59 p.m. Friday will have a total
of 40 points deducted for late.
Total point value of assignment: 100 points
********** NOTE: Not accepted after Friday at 11:59 p.m. **********
This assignment is to be done INDIVIDUALLY.
Create a directory, A5, which will contain all parts of this assignment.
The directory will contain a class named asg5.java, which contains
your main program. You will also need
a class, ExtBinTree, that extends Bailey's BinaryTree class (which
will contain a constructor and an elements method). Your
binary tree in asg5.java will be of type ExtBinTree
(see at end of assignment description.)
a class that implements the Iterator interface
The objectives of this program are to give you some experience writing
working with a binary trees and iterators.
You are to construct a postorder iterator which does not keep a
stack, queue, or any other container. The nextElement() method will
not be recursive. Instead, current "knows" where it is in the
tree and nextElement() reassigns current appropriately.
Input:
None required, but your main method may input values if
you wish.
Output:
Print your name, the assignment number, and a short description
of the assignment to the screen.
Your main method should construct a (fairly complex) binary
tree (of type ExtBinTree), invoke Bailey's preorder, inorder,
postorder, and level order iterators and then invoke your
postorder iterator (type MyPostIterator -- see below).
Other requirements:
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on your lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
Required documentation and style standards: 20 pts.
The program compiles without error 10 pts.
Warning: if you do not name your classes correctly and
submit all parts of your program, it will not compile.
Program must compile for further points to be awarded.
(Max points for programs that don't compile: 20)
Test tree contains at least 10 BinaryTreeNodes and is
not completely symmetric or completely balanced.
10 pts.
Required (your) iterator works correctly. 50 pts.
Quality of test program: 10 pts.
-------------------------------------------------------------------------
import structure.*;
public class ExtBinTree extends BinaryTree
{
public ExtBinTree()
{
super();
}
public Iterator EBTElements()
{
return new MyPostIterator(this.root);
}
}