Sample Code for Data Structures

Lecture 1:

Classes and subclasses

Rectangle.java
TestRectangle.java
LocatedRect.java
TestLR.java

Objects and references

TestObject.java

Parameter passing

TestParameters.java

Overloading

TestOverload.java
TestOverload1.java

Objects that reference other objects

Sexes.java
Person.java
TestPerson.java

Homework 1

Hwk1Ex3.java

Lecture 2. Abstract Methods and Interfaces. 9/8

Figures.java
ApplierAbs.java
TrapezoidAbs.java
ApplierInt.java
TrapezoidInt.java

Programming Assignment 1

NNAbs.java
NNInt.java

Lecture 4. Generics. 9/15

MyList.java
TestMyList.java
ApplierGenericAbs.java
ApplierGenericInt.java

Lecture 5. Lists. 9/20

ListAsArray.java
TestListAsArray.java
MyList1.java
TestMyList1.java
MyNode2.java
MyList2.java
TestMyList2.java

Lecture 6. More lists

Java library list classes

LL1.java

Ordered Arrays

OrderedArray.java
TestOrderedArray.java

Ordered Lists

OrderedList.java
TestOrderedList.java

Generic Ordered Arrays

GOrderedList.java
TestGOrderedList.java

Stacks

ArrayStack.java
TestArrayStack.java

FIFO Queues: List implementation

FIFOQueue.java
TestFIFOQueue.java

FIFO Queues: Circular array implementation

CircularArray.java
TestCircularArray.java

Lecture 7

TestSlowToString.java.
MyList1.java.
TestFastToString.java.
TestLibraryHash.java.
MyHashTable.java.
TestMyHashTable.java.

Lecture 8

TestEqualLists1.java
TestEqualLists2.java

Lecture 9: Trees

Tree.java
AnimalKingdom.java
BinaryTree.java
TestBinaryTree.java
ExpressionTree.java
TestExpressionTree.java

Lecture 10: More trees

ExpressionTree.java
TestExpressionTree.java
Tree1.java
AnimalGroup1.java
RecursiveTreeTraversal.java
MyStack.java
StackTreeTraversal1.java
StackTreeTraversal2.java
Tree.java
AnimalGroup.java
FIFOQueue.java
BreadthFirstSearch.java

Lecture 14:

ExpTree.java
Constant.java
Divide.java
Product.java
Subtract.java
Sum.java
TestExpTree.java
PrefixToExpTree.java

Lecture 20: Exception Handling

ArrayStack.java

A tester for the stack:

Test1.java

A program for evaluating postfix expressions that uses this stack:

EvalPostfix.java

Reading from input with a handler for IOException.

wc.java

Complex structure of catchers:

ComplexCatcher.java

Intersection points of triangles

Line.java
Segment.java
TriangleIntersections.java