This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 9
26 June 2000
Due: Monday, June 26 at midnight
Late penalties: 20 points per partial day late. That is, programs
turned in after midnight Monday and before midnight Tuesday
will have 20 points deducted for late.
Total point value of assignment: 100 points
********** NOTE: Not accepted after Tuesday midnight **********
Late submissions not accepted after: Tuesday, June 27 at midnight
This assignment is to be done INDIVIDUALLY.
Create a directory, A9, which will contain all parts of this assignment.
The directory will contain a class named asg9.java, which contains
your main program. You will also need
a class that extends Bailey's BinaryTree class (which will
contain a constructor and an elements method). Your
binary tree in asg9.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.
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.
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);
}
}